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.100.2", strlen("v0.0.100.2"));
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_Trace;
456 case 1: return LDKLevel_Debug;
457 case 2: return LDKLevel_Info;
458 case 3: return LDKLevel_Warn;
459 case 4: return LDKLevel_Error;
463 static jclass Level_class = NULL;
464 static jfieldID Level_LDKLevel_Trace = NULL;
465 static jfieldID Level_LDKLevel_Debug = NULL;
466 static jfieldID Level_LDKLevel_Info = NULL;
467 static jfieldID Level_LDKLevel_Warn = NULL;
468 static jfieldID Level_LDKLevel_Error = NULL;
469 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
470 Level_class = (*env)->NewGlobalRef(env, clz);
471 CHECK(Level_class != NULL);
472 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
473 CHECK(Level_LDKLevel_Trace != NULL);
474 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Debug != NULL);
476 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Info != 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_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Error != NULL);
483 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
486 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
488 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
499 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
500 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
501 case 0: return LDKNetwork_Bitcoin;
502 case 1: return LDKNetwork_Testnet;
503 case 2: return LDKNetwork_Regtest;
504 case 3: return LDKNetwork_Signet;
508 static jclass Network_class = NULL;
509 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
510 static jfieldID Network_LDKNetwork_Testnet = NULL;
511 static jfieldID Network_LDKNetwork_Regtest = NULL;
512 static jfieldID Network_LDKNetwork_Signet = NULL;
513 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
514 Network_class = (*env)->NewGlobalRef(env, clz);
515 CHECK(Network_class != NULL);
516 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
517 CHECK(Network_LDKNetwork_Bitcoin != NULL);
518 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
519 CHECK(Network_LDKNetwork_Testnet != NULL);
520 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
521 CHECK(Network_LDKNetwork_Regtest != NULL);
522 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
523 CHECK(Network_LDKNetwork_Signet != NULL);
525 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
527 case LDKNetwork_Bitcoin:
528 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
529 case LDKNetwork_Testnet:
530 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
531 case LDKNetwork_Regtest:
532 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
533 case LDKNetwork_Signet:
534 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
539 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
540 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
541 case 0: return LDKSecp256k1Error_IncorrectSignature;
542 case 1: return LDKSecp256k1Error_InvalidMessage;
543 case 2: return LDKSecp256k1Error_InvalidPublicKey;
544 case 3: return LDKSecp256k1Error_InvalidSignature;
545 case 4: return LDKSecp256k1Error_InvalidSecretKey;
546 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
547 case 6: return LDKSecp256k1Error_InvalidTweak;
548 case 7: return LDKSecp256k1Error_TweakCheckFailed;
549 case 8: return LDKSecp256k1Error_NotEnoughMemory;
553 static jclass Secp256k1Error_class = NULL;
554 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
563 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
564 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
565 CHECK(Secp256k1Error_class != NULL);
566 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
567 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
568 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
569 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
570 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
571 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
572 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
580 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
582 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
585 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
587 case LDKSecp256k1Error_IncorrectSignature:
588 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
589 case LDKSecp256k1Error_InvalidMessage:
590 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
591 case LDKSecp256k1Error_InvalidPublicKey:
592 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
593 case LDKSecp256k1Error_InvalidSignature:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
595 case LDKSecp256k1Error_InvalidSecretKey:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
597 case LDKSecp256k1Error_InvalidRecoveryId:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
599 case LDKSecp256k1Error_InvalidTweak:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
601 case LDKSecp256k1Error_TweakCheckFailed:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
603 case LDKSecp256k1Error_NotEnoughMemory:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
609 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
610 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
611 case 0: return LDKSemanticError_NoPaymentHash;
612 case 1: return LDKSemanticError_MultiplePaymentHashes;
613 case 2: return LDKSemanticError_NoDescription;
614 case 3: return LDKSemanticError_MultipleDescriptions;
615 case 4: return LDKSemanticError_MultiplePaymentSecrets;
616 case 5: return LDKSemanticError_InvalidFeatures;
617 case 6: return LDKSemanticError_InvalidRecoveryId;
618 case 7: return LDKSemanticError_InvalidSignature;
622 static jclass SemanticError_class = NULL;
623 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
624 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
625 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
626 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
627 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
628 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
629 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
630 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
631 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
632 SemanticError_class = (*env)->NewGlobalRef(env, clz);
633 CHECK(SemanticError_class != NULL);
634 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
635 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
636 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
637 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
638 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
639 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
640 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
642 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
644 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
646 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
648 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
651 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
653 case LDKSemanticError_NoPaymentHash:
654 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
655 case LDKSemanticError_MultiplePaymentHashes:
656 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
657 case LDKSemanticError_NoDescription:
658 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
659 case LDKSemanticError_MultipleDescriptions:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
661 case LDKSemanticError_MultiplePaymentSecrets:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
663 case LDKSemanticError_InvalidFeatures:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
665 case LDKSemanticError_InvalidRecoveryId:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
667 case LDKSemanticError_InvalidSignature:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
673 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
674 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
675 case 0: return LDKSiPrefix_Milli;
676 case 1: return LDKSiPrefix_Micro;
677 case 2: return LDKSiPrefix_Nano;
678 case 3: return LDKSiPrefix_Pico;
682 static jclass SiPrefix_class = NULL;
683 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
684 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
685 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
686 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
687 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
688 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
689 CHECK(SiPrefix_class != NULL);
690 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
691 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
692 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
693 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
694 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
695 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
696 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
697 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
699 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
701 case LDKSiPrefix_Milli:
702 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
703 case LDKSiPrefix_Micro:
704 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
705 case LDKSiPrefix_Nano:
706 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
707 case LDKSiPrefix_Pico:
708 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
714 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
715 ret->datalen = (*env)->GetArrayLength(env, elems);
716 if (ret->datalen == 0) {
719 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
720 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
721 for (size_t i = 0; i < ret->datalen; i++) {
722 ret->data[i] = java_elems[i];
724 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
726 return (uint64_t)ret;
728 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
729 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
730 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
733 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
734 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
735 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
736 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
737 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
738 CVec_u8Z_free(ret_var);
742 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
743 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
744 int64_t ret_val = TxOut_get_value(thing_conv);
748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
749 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
752 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
753 CHECK(val->result_ok);
754 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
755 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
758 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
759 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
760 CHECK(!val->result_ok);
761 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
765 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
768 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
769 CHECK(val->result_ok);
770 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
771 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
774 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
775 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
776 CHECK(!val->result_ok);
777 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
781 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
784 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
785 CHECK(val->result_ok);
786 LDKTxCreationKeys res_var = (*val->contents.result);
787 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
793 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
794 CHECK(!val->result_ok);
795 LDKDecodeError err_var = (*val->contents.err);
796 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
797 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
798 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
802 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
805 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
806 CHECK(val->result_ok);
807 LDKChannelPublicKeys res_var = (*val->contents.result);
808 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
809 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
810 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
814 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
815 CHECK(!val->result_ok);
816 LDKDecodeError err_var = (*val->contents.err);
817 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
818 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
819 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
823 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
826 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
827 CHECK(val->result_ok);
828 LDKTxCreationKeys res_var = (*val->contents.result);
829 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
830 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
831 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
834 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
835 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
836 CHECK(!val->result_ok);
837 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
840 static jclass LDKCOption_u32Z_Some_class = NULL;
841 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
842 static jclass LDKCOption_u32Z_None_class = NULL;
843 static jmethodID LDKCOption_u32Z_None_meth = NULL;
844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
845 LDKCOption_u32Z_Some_class =
846 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
847 CHECK(LDKCOption_u32Z_Some_class != NULL);
848 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
849 CHECK(LDKCOption_u32Z_Some_meth != NULL);
850 LDKCOption_u32Z_None_class =
851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
852 CHECK(LDKCOption_u32Z_None_class != NULL);
853 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
854 CHECK(LDKCOption_u32Z_None_meth != NULL);
856 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
857 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
859 case LDKCOption_u32Z_Some: {
860 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
862 case LDKCOption_u32Z_None: {
863 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
869 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
872 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
873 CHECK(val->result_ok);
874 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
875 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
876 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
877 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
881 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
882 CHECK(!val->result_ok);
883 LDKDecodeError err_var = (*val->contents.err);
884 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
885 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
886 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
890 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
893 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
894 CHECK(val->result_ok);
895 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
896 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
897 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
898 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
902 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
903 CHECK(!val->result_ok);
904 LDKDecodeError err_var = (*val->contents.err);
905 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
906 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
907 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
911 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
914 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
915 CHECK(val->result_ok);
916 LDKChannelTransactionParameters res_var = (*val->contents.result);
917 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
918 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
919 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
923 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
924 CHECK(!val->result_ok);
925 LDKDecodeError err_var = (*val->contents.err);
926 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
927 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
928 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
932 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
935 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
936 CHECK(val->result_ok);
937 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
938 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
944 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
945 CHECK(!val->result_ok);
946 LDKDecodeError err_var = (*val->contents.err);
947 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
948 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
949 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
953 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
956 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
957 CHECK(val->result_ok);
958 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
959 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
965 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
966 CHECK(!val->result_ok);
967 LDKDecodeError err_var = (*val->contents.err);
968 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
969 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
970 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
974 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
977 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
978 CHECK(val->result_ok);
979 LDKCommitmentTransaction res_var = (*val->contents.result);
980 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
986 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
987 CHECK(!val->result_ok);
988 LDKDecodeError err_var = (*val->contents.err);
989 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
990 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
991 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
995 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
998 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
999 CHECK(val->result_ok);
1000 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1001 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1002 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1003 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1007 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1008 CHECK(!val->result_ok);
1009 return *val->contents.err;
1011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1012 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1014 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1015 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1016 CHECK(val->result_ok);
1017 LDKCVec_SignatureZ res_var = (*val->contents.result);
1018 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1020 for (size_t i = 0; i < res_var.datalen; i++) {
1021 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1022 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1023 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1028 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1029 CHECK(!val->result_ok);
1030 return *val->contents.err;
1032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1033 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1036 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1037 CHECK(val->result_ok);
1038 LDKShutdownScript res_var = (*val->contents.result);
1039 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1040 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1041 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1045 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1046 CHECK(!val->result_ok);
1047 LDKDecodeError err_var = (*val->contents.err);
1048 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1049 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1050 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1054 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1057 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1058 CHECK(val->result_ok);
1059 LDKShutdownScript res_var = (*val->contents.result);
1060 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1061 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1062 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1066 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1067 CHECK(!val->result_ok);
1068 LDKInvalidShutdownScript err_var = (*val->contents.err);
1069 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1070 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1071 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1075 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1078 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1079 CHECK(val->result_ok);
1080 return *val->contents.result;
1082 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1083 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1084 CHECK(!val->result_ok);
1085 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1089 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1092 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1093 CHECK(val->result_ok);
1094 LDKRouteHop res_var = (*val->contents.result);
1095 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1096 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1097 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1101 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1102 CHECK(!val->result_ok);
1103 LDKDecodeError err_var = (*val->contents.err);
1104 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1105 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1106 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1110 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1111 ret->datalen = (*env)->GetArrayLength(env, elems);
1112 if (ret->datalen == 0) {
1115 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1116 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1117 for (size_t i = 0; i < ret->datalen; i++) {
1118 int64_t arr_elem = java_elems[i];
1119 LDKRouteHop arr_elem_conv;
1120 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1121 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1122 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1123 ret->data[i] = arr_elem_conv;
1125 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1127 return (uint64_t)ret;
1129 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1130 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1131 for (size_t i = 0; i < ret.datalen; i++) {
1132 ret.data[i] = RouteHop_clone(&orig->data[i]);
1136 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1137 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1138 for (size_t i = 0; i < ret.datalen; i++) {
1139 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1144 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1147 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1148 CHECK(val->result_ok);
1149 LDKRoute res_var = (*val->contents.result);
1150 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1151 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1152 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1156 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1157 CHECK(!val->result_ok);
1158 LDKDecodeError err_var = (*val->contents.err);
1159 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1160 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1161 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1164 static jclass LDKCOption_u64Z_Some_class = NULL;
1165 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1166 static jclass LDKCOption_u64Z_None_class = NULL;
1167 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1169 LDKCOption_u64Z_Some_class =
1170 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1171 CHECK(LDKCOption_u64Z_Some_class != NULL);
1172 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1173 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1174 LDKCOption_u64Z_None_class =
1175 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1176 CHECK(LDKCOption_u64Z_None_class != NULL);
1177 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1178 CHECK(LDKCOption_u64Z_None_meth != NULL);
1180 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1181 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1183 case LDKCOption_u64Z_Some: {
1184 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1186 case LDKCOption_u64Z_None: {
1187 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1193 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1194 ret->datalen = (*env)->GetArrayLength(env, elems);
1195 if (ret->datalen == 0) {
1198 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1199 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1200 for (size_t i = 0; i < ret->datalen; i++) {
1201 int64_t arr_elem = java_elems[i];
1202 LDKChannelDetails arr_elem_conv;
1203 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1204 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1205 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1206 ret->data[i] = arr_elem_conv;
1208 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1210 return (uint64_t)ret;
1212 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1213 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1214 for (size_t i = 0; i < ret.datalen; i++) {
1215 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1220 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1221 ret->datalen = (*env)->GetArrayLength(env, elems);
1222 if (ret->datalen == 0) {
1225 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1226 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1227 for (size_t i = 0; i < ret->datalen; i++) {
1228 int64_t arr_elem = java_elems[i];
1229 LDKRouteHint arr_elem_conv;
1230 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1231 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1232 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1233 ret->data[i] = arr_elem_conv;
1235 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1237 return (uint64_t)ret;
1239 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1240 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1241 for (size_t i = 0; i < ret.datalen; i++) {
1242 ret.data[i] = RouteHint_clone(&orig->data[i]);
1246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1247 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1250 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1251 CHECK(val->result_ok);
1252 LDKRoute res_var = (*val->contents.result);
1253 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1254 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1255 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1259 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1260 CHECK(!val->result_ok);
1261 LDKLightningError err_var = (*val->contents.err);
1262 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1263 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1264 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1268 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1271 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1272 CHECK(val->result_ok);
1273 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1274 return (uint64_t)res_ref;
1276 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1277 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1278 CHECK(!val->result_ok);
1279 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1283 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1285 LDKTransaction b_ref;
1286 b_ref.datalen = (*env)->GetArrayLength(env, b);
1287 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1288 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1289 b_ref.data_is_owned = false;
1291 return (uint64_t)ret;
1293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1294 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1298 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1299 LDKTransaction b_var = tuple->b;
1300 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1301 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1305 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1306 ret->datalen = (*env)->GetArrayLength(env, elems);
1307 if (ret->datalen == 0) {
1310 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1311 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1312 for (size_t i = 0; i < ret->datalen; i++) {
1313 int64_t arr_elem = java_elems[i];
1314 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1315 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1316 ret->data[i] = arr_elem_conv;
1318 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1320 return (uint64_t)ret;
1322 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1323 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1324 for (size_t i = 0; i < ret.datalen; i++) {
1325 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1329 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1330 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1331 for (size_t i = 0; i < ret.datalen; i++) {
1332 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1337 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1340 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1341 CHECK(val->result_ok);
1342 return *val->contents.result;
1344 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1345 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1346 CHECK(!val->result_ok);
1347 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1350 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1351 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1352 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1353 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1355 LDKMonitorEvent_HTLCEvent_class =
1356 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1357 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1358 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1359 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1360 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1361 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1362 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1363 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1364 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1366 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1367 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1369 case LDKMonitorEvent_HTLCEvent: {
1370 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1371 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1372 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1373 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1374 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1376 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1377 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1378 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1379 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1380 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1381 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1387 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1388 ret->datalen = (*env)->GetArrayLength(env, elems);
1389 if (ret->datalen == 0) {
1392 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1393 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1394 for (size_t i = 0; i < ret->datalen; i++) {
1395 int64_t arr_elem = java_elems[i];
1396 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1397 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1398 ret->data[i] = arr_elem_conv;
1400 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1402 return (uint64_t)ret;
1404 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1405 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1406 for (size_t i = 0; i < ret.datalen; i++) {
1407 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1411 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1412 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1413 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1414 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1416 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1417 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1418 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1419 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1420 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1421 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1422 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1423 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1424 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1425 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1427 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1428 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1430 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1431 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1432 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1434 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1435 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1440 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1441 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1442 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1443 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1444 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1445 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1447 LDKSpendableOutputDescriptor_StaticOutput_class =
1448 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1449 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1450 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1451 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1452 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1453 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1454 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1455 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1456 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1457 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1458 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1459 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1460 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1461 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1463 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1464 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1466 case LDKSpendableOutputDescriptor_StaticOutput: {
1467 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1468 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1469 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1470 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1471 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1472 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1474 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1475 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1476 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1477 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1478 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1479 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1481 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1482 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1483 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1484 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1485 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1486 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1492 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1493 ret->datalen = (*env)->GetArrayLength(env, elems);
1494 if (ret->datalen == 0) {
1497 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1498 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1499 for (size_t i = 0; i < ret->datalen; i++) {
1500 int64_t arr_elem = java_elems[i];
1501 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1502 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1503 ret->data[i] = arr_elem_conv;
1505 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1507 return (uint64_t)ret;
1509 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1510 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1511 for (size_t i = 0; i < ret.datalen; i++) {
1512 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1516 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1517 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1518 static jclass LDKErrorAction_IgnoreError_class = NULL;
1519 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1520 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1521 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1522 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1523 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1525 LDKErrorAction_DisconnectPeer_class =
1526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1527 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1528 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1529 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1530 LDKErrorAction_IgnoreError_class =
1531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1532 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1533 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1534 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1535 LDKErrorAction_IgnoreAndLog_class =
1536 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1537 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1538 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1539 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1540 LDKErrorAction_SendErrorMessage_class =
1541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1542 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1543 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1544 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1547 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1549 case LDKErrorAction_DisconnectPeer: {
1550 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1551 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1552 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1553 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1554 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1556 case LDKErrorAction_IgnoreError: {
1557 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1559 case LDKErrorAction_IgnoreAndLog: {
1560 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1561 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1563 case LDKErrorAction_SendErrorMessage: {
1564 LDKErrorMessage msg_var = obj->send_error_message.msg;
1565 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1566 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1567 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1568 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1573 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1574 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1575 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1576 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1577 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1578 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1580 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1581 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1582 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1583 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1584 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1585 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1586 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1587 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1588 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1589 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1590 LDKHTLCFailChannelUpdate_NodeFailure_class =
1591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1592 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1593 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1594 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1596 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1597 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1599 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1600 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1601 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1602 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1603 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1604 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1606 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1607 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1609 case LDKHTLCFailChannelUpdate_NodeFailure: {
1610 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1611 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1612 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1617 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1618 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1619 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1620 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1621 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1622 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1623 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1624 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1625 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1626 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1627 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1628 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1629 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1630 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1631 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1632 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1633 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1634 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1635 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1636 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1637 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1638 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1639 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1640 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1641 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1642 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1643 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1644 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1645 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1646 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1647 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1648 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1649 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1650 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1651 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1652 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1653 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1654 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1655 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1656 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1658 LDKMessageSendEvent_SendAcceptChannel_class =
1659 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1660 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1661 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1662 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1663 LDKMessageSendEvent_SendOpenChannel_class =
1664 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1665 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1666 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1667 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1668 LDKMessageSendEvent_SendFundingCreated_class =
1669 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1670 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1671 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1672 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1673 LDKMessageSendEvent_SendFundingSigned_class =
1674 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1675 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1676 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1677 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1678 LDKMessageSendEvent_SendFundingLocked_class =
1679 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1680 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1681 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1682 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1683 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1684 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1685 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1686 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1687 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1688 LDKMessageSendEvent_UpdateHTLCs_class =
1689 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1690 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1691 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1692 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1693 LDKMessageSendEvent_SendRevokeAndACK_class =
1694 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1695 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1696 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1697 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1698 LDKMessageSendEvent_SendClosingSigned_class =
1699 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1700 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1701 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1702 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1703 LDKMessageSendEvent_SendShutdown_class =
1704 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1705 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1706 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1707 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1708 LDKMessageSendEvent_SendChannelReestablish_class =
1709 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1710 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1711 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1712 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1713 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1714 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1715 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1716 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1717 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1718 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1720 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1721 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1722 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1723 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1724 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1725 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1726 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1727 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1728 LDKMessageSendEvent_SendChannelUpdate_class =
1729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1730 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1731 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1732 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1733 LDKMessageSendEvent_HandleError_class =
1734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1735 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1736 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1737 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1738 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1740 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1741 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1742 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1743 LDKMessageSendEvent_SendChannelRangeQuery_class =
1744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1745 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1746 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1747 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1748 LDKMessageSendEvent_SendShortIdsQuery_class =
1749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1750 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1751 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1752 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1753 LDKMessageSendEvent_SendReplyChannelRange_class =
1754 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1755 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1756 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1757 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1759 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1760 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1762 case LDKMessageSendEvent_SendAcceptChannel: {
1763 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1764 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1765 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1766 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1767 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1768 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1769 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1771 case LDKMessageSendEvent_SendOpenChannel: {
1772 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1773 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1774 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1775 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1776 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1777 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1778 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1780 case LDKMessageSendEvent_SendFundingCreated: {
1781 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1782 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1783 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1784 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1785 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1786 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1787 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1789 case LDKMessageSendEvent_SendFundingSigned: {
1790 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1791 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1792 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1793 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1794 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1795 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1796 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1798 case LDKMessageSendEvent_SendFundingLocked: {
1799 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1800 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1801 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1802 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1803 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1804 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1805 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1807 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1808 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1809 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1810 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1811 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1812 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1813 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1814 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1816 case LDKMessageSendEvent_UpdateHTLCs: {
1817 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1818 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1819 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1820 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1821 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1822 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1823 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1825 case LDKMessageSendEvent_SendRevokeAndACK: {
1826 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1827 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1828 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1829 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1830 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1831 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1832 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1834 case LDKMessageSendEvent_SendClosingSigned: {
1835 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1836 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1837 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1838 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1839 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1840 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1841 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1843 case LDKMessageSendEvent_SendShutdown: {
1844 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1845 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1846 LDKShutdown msg_var = obj->send_shutdown.msg;
1847 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1848 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1849 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1850 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1852 case LDKMessageSendEvent_SendChannelReestablish: {
1853 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1854 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1855 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1856 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1857 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1858 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1859 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1861 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1862 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1865 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1866 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1867 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1868 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1869 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1870 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1872 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1873 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1874 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1875 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1876 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1877 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1879 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1880 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1881 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1882 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1883 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1884 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1886 case LDKMessageSendEvent_SendChannelUpdate: {
1887 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1888 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1889 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1890 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1891 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1892 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1893 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1895 case LDKMessageSendEvent_HandleError: {
1896 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1897 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1898 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1899 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1901 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1902 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1903 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1905 case LDKMessageSendEvent_SendChannelRangeQuery: {
1906 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1907 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1908 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1909 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1910 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1911 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1912 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1914 case LDKMessageSendEvent_SendShortIdsQuery: {
1915 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1916 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1917 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1918 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1919 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1920 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1921 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1923 case LDKMessageSendEvent_SendReplyChannelRange: {
1924 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1925 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1926 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1927 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1928 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1929 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1930 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1936 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1937 ret->datalen = (*env)->GetArrayLength(env, elems);
1938 if (ret->datalen == 0) {
1941 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1942 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1943 for (size_t i = 0; i < ret->datalen; i++) {
1944 int64_t arr_elem = java_elems[i];
1945 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1946 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1947 ret->data[i] = arr_elem_conv;
1949 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1951 return (uint64_t)ret;
1953 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1954 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1955 for (size_t i = 0; i < ret.datalen; i++) {
1956 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1961 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1964 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1965 CHECK(val->result_ok);
1966 LDKInitFeatures res_var = (*val->contents.result);
1967 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1973 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1974 CHECK(!val->result_ok);
1975 LDKDecodeError err_var = (*val->contents.err);
1976 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1977 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1978 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1982 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1985 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1986 CHECK(val->result_ok);
1987 LDKNodeFeatures res_var = (*val->contents.result);
1988 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1989 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1990 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1994 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1995 CHECK(!val->result_ok);
1996 LDKDecodeError err_var = (*val->contents.err);
1997 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1998 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1999 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2003 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2006 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2007 CHECK(val->result_ok);
2008 LDKChannelFeatures res_var = (*val->contents.result);
2009 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2010 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2011 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2015 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2016 CHECK(!val->result_ok);
2017 LDKDecodeError err_var = (*val->contents.err);
2018 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2019 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2020 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2024 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2027 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2028 CHECK(val->result_ok);
2029 LDKInvoiceFeatures res_var = (*val->contents.result);
2030 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2031 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2032 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2036 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2037 CHECK(!val->result_ok);
2038 LDKDecodeError err_var = (*val->contents.err);
2039 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2040 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2041 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2045 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2048 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2049 CHECK(val->result_ok);
2050 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2051 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2052 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2053 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2057 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2058 CHECK(!val->result_ok);
2059 LDKDecodeError err_var = (*val->contents.err);
2060 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2061 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2062 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2066 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2069 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2070 CHECK(val->result_ok);
2071 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2072 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2073 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2074 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2078 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2079 CHECK(!val->result_ok);
2080 LDKDecodeError err_var = (*val->contents.err);
2081 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2082 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2083 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2087 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2090 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2091 CHECK(val->result_ok);
2092 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2096 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2097 CHECK(!val->result_ok);
2098 LDKDecodeError err_var = (*val->contents.err);
2099 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2100 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2101 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2105 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2107 CHECK((*env)->GetArrayLength(env, a) == 64);
2108 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2110 LDKCVec_SignatureZ b_constr;
2111 b_constr.datalen = (*env)->GetArrayLength(env, b);
2112 if (b_constr.datalen > 0)
2113 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2115 b_constr.data = NULL;
2116 for (size_t i = 0; i < b_constr.datalen; i++) {
2117 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2118 LDKSignature b_conv_8_ref;
2119 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2120 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2121 b_constr.data[i] = b_conv_8_ref;
2124 return (uint64_t)ret;
2126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2127 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2128 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2129 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2132 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2133 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2134 LDKCVec_SignatureZ b_var = tuple->b;
2135 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2137 for (size_t i = 0; i < b_var.datalen; i++) {
2138 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2139 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2140 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2145 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2148 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2149 CHECK(val->result_ok);
2150 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2154 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2155 CHECK(!val->result_ok);
2156 return *val->contents.err;
2158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2159 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2162 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2163 CHECK(val->result_ok);
2164 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2165 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2169 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2170 CHECK(!val->result_ok);
2171 return *val->contents.err;
2173 typedef struct LDKBaseSign_JCalls {
2174 atomic_size_t refcnt;
2177 jmethodID get_per_commitment_point_meth;
2178 jmethodID release_commitment_secret_meth;
2179 jmethodID channel_keys_id_meth;
2180 jmethodID sign_counterparty_commitment_meth;
2181 jmethodID sign_holder_commitment_and_htlcs_meth;
2182 jmethodID sign_justice_revoked_output_meth;
2183 jmethodID sign_justice_revoked_htlc_meth;
2184 jmethodID sign_counterparty_htlc_transaction_meth;
2185 jmethodID sign_closing_transaction_meth;
2186 jmethodID sign_channel_announcement_meth;
2187 jmethodID ready_channel_meth;
2188 } LDKBaseSign_JCalls;
2189 static void LDKBaseSign_JCalls_free(void* this_arg) {
2190 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2191 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2193 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2194 if (get_jenv_res == JNI_EDETACHED) {
2195 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2197 DO_ASSERT(get_jenv_res == JNI_OK);
2199 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2200 if (get_jenv_res == JNI_EDETACHED) {
2201 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2206 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2207 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2209 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2210 if (get_jenv_res == JNI_EDETACHED) {
2211 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2213 DO_ASSERT(get_jenv_res == JNI_OK);
2215 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2217 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2218 if ((*env)->ExceptionCheck(env)) {
2219 (*env)->ExceptionDescribe(env);
2220 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2222 LDKPublicKey ret_ref;
2223 CHECK((*env)->GetArrayLength(env, ret) == 33);
2224 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2225 if (get_jenv_res == JNI_EDETACHED) {
2226 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2230 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2231 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2233 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2234 if (get_jenv_res == JNI_EDETACHED) {
2235 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2237 DO_ASSERT(get_jenv_res == JNI_OK);
2239 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2241 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2242 if ((*env)->ExceptionCheck(env)) {
2243 (*env)->ExceptionDescribe(env);
2244 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2246 LDKThirtyTwoBytes ret_ref;
2247 CHECK((*env)->GetArrayLength(env, ret) == 32);
2248 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2249 if (get_jenv_res == JNI_EDETACHED) {
2250 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2254 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2255 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2257 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2258 if (get_jenv_res == JNI_EDETACHED) {
2259 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2261 DO_ASSERT(get_jenv_res == JNI_OK);
2263 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2265 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2266 if ((*env)->ExceptionCheck(env)) {
2267 (*env)->ExceptionDescribe(env);
2268 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2270 LDKThirtyTwoBytes ret_ref;
2271 CHECK((*env)->GetArrayLength(env, ret) == 32);
2272 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2273 if (get_jenv_res == JNI_EDETACHED) {
2274 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2278 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2279 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2282 if (get_jenv_res == JNI_EDETACHED) {
2283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2285 DO_ASSERT(get_jenv_res == JNI_OK);
2287 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2288 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2289 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2290 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2291 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2292 if (commitment_tx_var.is_owned) {
2293 commitment_tx_ref |= 1;
2295 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2297 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2298 if ((*env)->ExceptionCheck(env)) {
2299 (*env)->ExceptionDescribe(env);
2300 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2302 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2303 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2304 if (get_jenv_res == JNI_EDETACHED) {
2305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2309 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2310 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2312 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2313 if (get_jenv_res == JNI_EDETACHED) {
2314 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2316 DO_ASSERT(get_jenv_res == JNI_OK);
2318 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2319 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2320 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2321 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2322 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2323 if (commitment_tx_var.is_owned) {
2324 commitment_tx_ref |= 1;
2326 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2328 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2329 if ((*env)->ExceptionCheck(env)) {
2330 (*env)->ExceptionDescribe(env);
2331 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2333 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2334 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2335 if (get_jenv_res == JNI_EDETACHED) {
2336 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2340 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]) {
2341 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2343 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2344 if (get_jenv_res == JNI_EDETACHED) {
2345 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2347 DO_ASSERT(get_jenv_res == JNI_OK);
2349 LDKTransaction justice_tx_var = justice_tx;
2350 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2351 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2352 Transaction_free(justice_tx_var);
2353 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2354 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2357 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2358 if ((*env)->ExceptionCheck(env)) {
2359 (*env)->ExceptionDescribe(env);
2360 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2362 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2363 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2364 if (get_jenv_res == JNI_EDETACHED) {
2365 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2369 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) {
2370 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2372 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2373 if (get_jenv_res == JNI_EDETACHED) {
2374 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2376 DO_ASSERT(get_jenv_res == JNI_OK);
2378 LDKTransaction justice_tx_var = justice_tx;
2379 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2380 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2381 Transaction_free(justice_tx_var);
2382 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2383 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2384 LDKHTLCOutputInCommitment htlc_var = *htlc;
2385 htlc_var = HTLCOutputInCommitment_clone(htlc);
2386 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2387 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2388 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2389 if (htlc_var.is_owned) {
2392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2394 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2395 if ((*env)->ExceptionCheck(env)) {
2396 (*env)->ExceptionDescribe(env);
2397 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2399 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2400 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2401 if (get_jenv_res == JNI_EDETACHED) {
2402 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2406 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) {
2407 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2409 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2410 if (get_jenv_res == JNI_EDETACHED) {
2411 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2413 DO_ASSERT(get_jenv_res == JNI_OK);
2415 LDKTransaction htlc_tx_var = htlc_tx;
2416 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2417 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2418 Transaction_free(htlc_tx_var);
2419 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2420 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2421 LDKHTLCOutputInCommitment htlc_var = *htlc;
2422 htlc_var = HTLCOutputInCommitment_clone(htlc);
2423 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2424 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2425 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2426 if (htlc_var.is_owned) {
2429 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2431 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2432 if ((*env)->ExceptionCheck(env)) {
2433 (*env)->ExceptionDescribe(env);
2434 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2436 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2437 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2438 if (get_jenv_res == JNI_EDETACHED) {
2439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2443 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2444 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2446 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2447 if (get_jenv_res == JNI_EDETACHED) {
2448 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2450 DO_ASSERT(get_jenv_res == JNI_OK);
2452 LDKTransaction closing_tx_var = closing_tx;
2453 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2454 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2455 Transaction_free(closing_tx_var);
2456 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2458 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2459 if ((*env)->ExceptionCheck(env)) {
2460 (*env)->ExceptionDescribe(env);
2461 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2463 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2464 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2465 if (get_jenv_res == JNI_EDETACHED) {
2466 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2470 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2471 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2473 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2474 if (get_jenv_res == JNI_EDETACHED) {
2475 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2477 DO_ASSERT(get_jenv_res == JNI_OK);
2479 LDKUnsignedChannelAnnouncement msg_var = *msg;
2480 msg_var = UnsignedChannelAnnouncement_clone(msg);
2481 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2482 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2483 uint64_t msg_ref = (uint64_t)msg_var.inner;
2484 if (msg_var.is_owned) {
2487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2489 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2490 if ((*env)->ExceptionCheck(env)) {
2491 (*env)->ExceptionDescribe(env);
2492 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2494 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2495 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2496 if (get_jenv_res == JNI_EDETACHED) {
2497 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2501 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2502 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2504 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2505 if (get_jenv_res == JNI_EDETACHED) {
2506 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2508 DO_ASSERT(get_jenv_res == JNI_OK);
2510 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2511 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2512 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2513 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2514 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2515 if (channel_parameters_var.is_owned) {
2516 channel_parameters_ref |= 1;
2518 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2520 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2521 if ((*env)->ExceptionCheck(env)) {
2522 (*env)->ExceptionDescribe(env);
2523 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2525 if (get_jenv_res == JNI_EDETACHED) {
2526 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2529 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2530 jclass c = (*env)->GetObjectClass(env, o);
2532 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2533 atomic_init(&calls->refcnt, 1);
2534 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2535 calls->o = (*env)->NewWeakGlobalRef(env, o);
2536 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2537 CHECK(calls->get_per_commitment_point_meth != NULL);
2538 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2539 CHECK(calls->release_commitment_secret_meth != NULL);
2540 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2541 CHECK(calls->channel_keys_id_meth != NULL);
2542 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2543 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2544 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2545 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2546 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2547 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2548 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2549 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2550 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2551 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2552 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2553 CHECK(calls->sign_closing_transaction_meth != NULL);
2554 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2555 CHECK(calls->sign_channel_announcement_meth != NULL);
2556 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2557 CHECK(calls->ready_channel_meth != NULL);
2559 LDKChannelPublicKeys pubkeys_conv;
2560 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2561 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2562 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2565 .this_arg = (void*) calls,
2566 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2567 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2568 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2569 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2570 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2571 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2572 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2573 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2574 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2575 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2576 .ready_channel = ready_channel_LDKBaseSign_jcall,
2577 .free = LDKBaseSign_JCalls_free,
2578 .pubkeys = pubkeys_conv,
2579 .set_pubkeys = NULL,
2583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2584 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2585 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2586 return (uint64_t)res_ptr;
2588 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) {
2589 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2590 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2591 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2596 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2597 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2603 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2604 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2605 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2609 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) {
2610 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2611 LDKCommitmentTransaction commitment_tx_conv;
2612 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2613 commitment_tx_conv.is_owned = false;
2614 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2615 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2616 return (uint64_t)ret_conv;
2619 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) {
2620 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2621 LDKHolderCommitmentTransaction commitment_tx_conv;
2622 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2623 commitment_tx_conv.is_owned = false;
2624 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2625 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2626 return (uint64_t)ret_conv;
2629 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) {
2630 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2631 LDKTransaction justice_tx_ref;
2632 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2633 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2634 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2635 justice_tx_ref.data_is_owned = true;
2636 unsigned char per_commitment_key_arr[32];
2637 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2638 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2639 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2640 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2641 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2642 return (uint64_t)ret_conv;
2645 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) {
2646 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2647 LDKTransaction justice_tx_ref;
2648 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2649 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2650 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2651 justice_tx_ref.data_is_owned = true;
2652 unsigned char per_commitment_key_arr[32];
2653 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2654 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2655 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2656 LDKHTLCOutputInCommitment htlc_conv;
2657 htlc_conv.inner = (void*)(htlc & (~1));
2658 htlc_conv.is_owned = false;
2659 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2660 *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);
2661 return (uint64_t)ret_conv;
2664 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) {
2665 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2666 LDKTransaction htlc_tx_ref;
2667 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2668 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2669 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2670 htlc_tx_ref.data_is_owned = true;
2671 LDKPublicKey per_commitment_point_ref;
2672 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2673 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2674 LDKHTLCOutputInCommitment htlc_conv;
2675 htlc_conv.inner = (void*)(htlc & (~1));
2676 htlc_conv.is_owned = false;
2677 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2678 *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);
2679 return (uint64_t)ret_conv;
2682 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) {
2683 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2684 LDKTransaction closing_tx_ref;
2685 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2686 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2687 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2688 closing_tx_ref.data_is_owned = true;
2689 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2690 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2691 return (uint64_t)ret_conv;
2694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2695 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2696 LDKUnsignedChannelAnnouncement msg_conv;
2697 msg_conv.inner = (void*)(msg & (~1));
2698 msg_conv.is_owned = false;
2699 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2700 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2701 return (uint64_t)ret_conv;
2704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2705 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2706 LDKChannelTransactionParameters channel_parameters_conv;
2707 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2708 channel_parameters_conv.is_owned = false;
2709 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2712 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2713 if (this_arg->set_pubkeys != NULL)
2714 this_arg->set_pubkeys(this_arg);
2715 return this_arg->pubkeys;
2717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2718 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2719 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2722 uint64_t ret_ref = (uint64_t)ret_var.inner;
2723 if (ret_var.is_owned) {
2729 typedef struct LDKSign_JCalls {
2730 atomic_size_t refcnt;
2733 LDKBaseSign_JCalls* BaseSign;
2734 jmethodID write_meth;
2736 static void LDKSign_JCalls_free(void* this_arg) {
2737 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2738 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2740 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2741 if (get_jenv_res == JNI_EDETACHED) {
2742 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2744 DO_ASSERT(get_jenv_res == JNI_OK);
2746 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2747 if (get_jenv_res == JNI_EDETACHED) {
2748 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2753 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2754 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2756 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2757 if (get_jenv_res == JNI_EDETACHED) {
2758 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2760 DO_ASSERT(get_jenv_res == JNI_OK);
2762 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2764 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2765 if ((*env)->ExceptionCheck(env)) {
2766 (*env)->ExceptionDescribe(env);
2767 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2769 LDKCVec_u8Z ret_ref;
2770 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2771 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2772 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2773 if (get_jenv_res == JNI_EDETACHED) {
2774 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2778 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2779 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2780 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2781 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2783 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2784 jclass c = (*env)->GetObjectClass(env, o);
2786 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2787 atomic_init(&calls->refcnt, 1);
2788 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2789 calls->o = (*env)->NewWeakGlobalRef(env, o);
2790 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2791 CHECK(calls->write_meth != NULL);
2793 LDKChannelPublicKeys pubkeys_conv;
2794 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2795 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2796 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2799 .this_arg = (void*) calls,
2800 .write = write_LDKSign_jcall,
2801 .cloned = LDKSign_JCalls_cloned,
2802 .free = LDKSign_JCalls_free,
2803 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2805 calls->BaseSign = ret.BaseSign.this_arg;
2808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2809 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2810 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2811 return (uint64_t)res_ptr;
2813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2814 LDKSign *inp = (LDKSign *)(arg & ~1);
2815 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2816 DO_ASSERT((res_ptr & 1) == 0);
2817 return (int64_t)(res_ptr | 1);
2819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2820 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2821 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2822 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2823 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2824 CVec_u8Z_free(ret_var);
2828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2829 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2832 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2833 CHECK(val->result_ok);
2834 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2835 *ret = Sign_clone(&(*val->contents.result));
2836 return (uint64_t)ret;
2838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2839 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2840 CHECK(!val->result_ok);
2841 LDKDecodeError err_var = (*val->contents.err);
2842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2848 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2851 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2852 CHECK(val->result_ok);
2853 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2854 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2858 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2859 CHECK(!val->result_ok);
2860 return *val->contents.err;
2862 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2863 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2864 for (size_t i = 0; i < ret.datalen; i++) {
2865 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2870 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2872 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2873 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2874 CHECK(val->result_ok);
2875 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2876 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2878 for (size_t i = 0; i < res_var.datalen; i++) {
2879 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2880 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2881 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2882 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2887 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2888 CHECK(!val->result_ok);
2889 return *val->contents.err;
2891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2892 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2895 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2896 CHECK(val->result_ok);
2897 LDKInMemorySigner res_var = (*val->contents.result);
2898 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2899 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2900 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2904 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2905 CHECK(!val->result_ok);
2906 LDKDecodeError err_var = (*val->contents.err);
2907 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2908 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2909 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2913 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2914 ret->datalen = (*env)->GetArrayLength(env, elems);
2915 if (ret->datalen == 0) {
2918 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2919 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2920 for (size_t i = 0; i < ret->datalen; i++) {
2921 int64_t arr_elem = java_elems[i];
2922 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2923 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2924 ret->data[i] = arr_elem_conv;
2926 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2928 return (uint64_t)ret;
2930 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2931 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2932 for (size_t i = 0; i < ret.datalen; i++) {
2933 ret.data[i] = TxOut_clone(&orig->data[i]);
2937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2938 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2941 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2942 CHECK(val->result_ok);
2943 LDKTransaction res_var = (*val->contents.result);
2944 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2945 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2949 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2950 CHECK(!val->result_ok);
2951 return *val->contents.err;
2953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2954 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2955 LDKThirtyTwoBytes a_ref;
2956 CHECK((*env)->GetArrayLength(env, a) == 32);
2957 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2959 LDKChannelMonitor b_conv;
2960 b_conv.inner = (void*)(b & (~1));
2961 b_conv.is_owned = (b & 1) || (b == 0);
2962 b_conv = ChannelMonitor_clone(&b_conv);
2964 return (uint64_t)ret;
2966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2967 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2968 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2969 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2973 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2974 LDKChannelMonitor b_var = tuple->b;
2975 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2976 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2977 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2981 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2982 ret->datalen = (*env)->GetArrayLength(env, elems);
2983 if (ret->datalen == 0) {
2986 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2987 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2988 for (size_t i = 0; i < ret->datalen; i++) {
2989 int64_t arr_elem = java_elems[i];
2990 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2991 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2992 ret->data[i] = arr_elem_conv;
2994 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2996 return (uint64_t)ret;
2998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2999 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3001 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3002 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3003 CHECK(val->result_ok);
3004 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3005 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3006 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3007 for (size_t i = 0; i < res_var.datalen; i++) {
3008 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
3009 res_arr_ptr[i] = res_conv_34_ref;
3011 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3014 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3015 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3016 CHECK(!val->result_ok);
3017 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3020 static jclass LDKCOption_u16Z_Some_class = NULL;
3021 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3022 static jclass LDKCOption_u16Z_None_class = NULL;
3023 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3025 LDKCOption_u16Z_Some_class =
3026 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3027 CHECK(LDKCOption_u16Z_Some_class != NULL);
3028 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3029 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3030 LDKCOption_u16Z_None_class =
3031 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3032 CHECK(LDKCOption_u16Z_None_class != NULL);
3033 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3034 CHECK(LDKCOption_u16Z_None_meth != NULL);
3036 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3037 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3039 case LDKCOption_u16Z_Some: {
3040 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3042 case LDKCOption_u16Z_None: {
3043 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3048 static jclass LDKAPIError_APIMisuseError_class = NULL;
3049 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3050 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3051 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3052 static jclass LDKAPIError_RouteError_class = NULL;
3053 static jmethodID LDKAPIError_RouteError_meth = NULL;
3054 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3055 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3056 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3057 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3058 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3059 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3061 LDKAPIError_APIMisuseError_class =
3062 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3063 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3064 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3065 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3066 LDKAPIError_FeeRateTooHigh_class =
3067 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3068 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3069 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3070 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3071 LDKAPIError_RouteError_class =
3072 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3073 CHECK(LDKAPIError_RouteError_class != NULL);
3074 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3075 CHECK(LDKAPIError_RouteError_meth != NULL);
3076 LDKAPIError_ChannelUnavailable_class =
3077 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3078 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3079 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3080 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3081 LDKAPIError_MonitorUpdateFailed_class =
3082 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3083 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3084 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3085 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3086 LDKAPIError_IncompatibleShutdownScript_class =
3087 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3088 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3089 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3090 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3092 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3093 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3095 case LDKAPIError_APIMisuseError: {
3096 LDKStr err_str = obj->api_misuse_error.err;
3097 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3098 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3100 case LDKAPIError_FeeRateTooHigh: {
3101 LDKStr err_str = obj->fee_rate_too_high.err;
3102 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3103 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3105 case LDKAPIError_RouteError: {
3106 LDKStr err_str = obj->route_error.err;
3107 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3108 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3110 case LDKAPIError_ChannelUnavailable: {
3111 LDKStr err_str = obj->channel_unavailable.err;
3112 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3113 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3115 case LDKAPIError_MonitorUpdateFailed: {
3116 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3118 case LDKAPIError_IncompatibleShutdownScript: {
3119 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3120 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3123 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3129 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3132 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3133 CHECK(val->result_ok);
3134 return *val->contents.result;
3136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3137 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3138 CHECK(!val->result_ok);
3139 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3143 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3144 ret->datalen = (*env)->GetArrayLength(env, elems);
3145 if (ret->datalen == 0) {
3148 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3149 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3150 for (size_t i = 0; i < ret->datalen; i++) {
3151 int64_t arr_elem = java_elems[i];
3152 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3153 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3154 ret->data[i] = arr_elem_conv;
3156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3158 return (uint64_t)ret;
3160 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3161 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3162 for (size_t i = 0; i < ret.datalen; i++) {
3163 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3168 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3169 ret->datalen = (*env)->GetArrayLength(env, elems);
3170 if (ret->datalen == 0) {
3173 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3174 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3175 for (size_t i = 0; i < ret->datalen; i++) {
3176 int64_t arr_elem = java_elems[i];
3177 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3178 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3179 ret->data[i] = arr_elem_conv;
3181 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3183 return (uint64_t)ret;
3185 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3186 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3187 for (size_t i = 0; i < ret.datalen; i++) {
3188 ret.data[i] = APIError_clone(&orig->data[i]);
3192 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3193 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3194 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3195 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3196 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3197 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3198 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3199 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3201 LDKPaymentSendFailure_ParameterError_class =
3202 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3203 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3204 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3205 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3206 LDKPaymentSendFailure_PathParameterError_class =
3207 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3208 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3209 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3210 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3211 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3212 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3213 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3214 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3215 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3216 LDKPaymentSendFailure_PartialFailure_class =
3217 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3218 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3219 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3220 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3222 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3223 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3225 case LDKPaymentSendFailure_ParameterError: {
3226 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3227 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3229 case LDKPaymentSendFailure_PathParameterError: {
3230 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3231 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3232 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3233 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3234 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3235 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3236 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3237 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3239 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3240 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3242 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3243 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3244 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3245 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3246 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3247 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3248 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3250 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3251 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3253 case LDKPaymentSendFailure_PartialFailure: {
3254 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3255 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3256 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3257 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3258 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3259 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3260 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3261 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3263 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3264 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3270 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3273 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3274 CHECK(val->result_ok);
3275 return *val->contents.result;
3277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3278 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3279 CHECK(!val->result_ok);
3280 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3284 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3287 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3288 CHECK(val->result_ok);
3289 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3290 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3294 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3295 CHECK(!val->result_ok);
3296 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3299 static jclass LDKNetAddress_IPv4_class = NULL;
3300 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3301 static jclass LDKNetAddress_IPv6_class = NULL;
3302 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3303 static jclass LDKNetAddress_OnionV2_class = NULL;
3304 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3305 static jclass LDKNetAddress_OnionV3_class = NULL;
3306 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3308 LDKNetAddress_IPv4_class =
3309 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3310 CHECK(LDKNetAddress_IPv4_class != NULL);
3311 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3312 CHECK(LDKNetAddress_IPv4_meth != NULL);
3313 LDKNetAddress_IPv6_class =
3314 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3315 CHECK(LDKNetAddress_IPv6_class != NULL);
3316 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3317 CHECK(LDKNetAddress_IPv6_meth != NULL);
3318 LDKNetAddress_OnionV2_class =
3319 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3320 CHECK(LDKNetAddress_OnionV2_class != NULL);
3321 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3322 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3323 LDKNetAddress_OnionV3_class =
3324 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3325 CHECK(LDKNetAddress_OnionV3_class != NULL);
3326 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3327 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3329 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3330 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3332 case LDKNetAddress_IPv4: {
3333 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3334 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3335 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3337 case LDKNetAddress_IPv6: {
3338 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3339 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3340 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3342 case LDKNetAddress_OnionV2: {
3343 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3344 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3345 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3347 case LDKNetAddress_OnionV3: {
3348 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3349 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3350 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);
3355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3356 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3357 ret->datalen = (*env)->GetArrayLength(env, elems);
3358 if (ret->datalen == 0) {
3361 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3362 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3363 for (size_t i = 0; i < ret->datalen; i++) {
3364 int64_t arr_elem = java_elems[i];
3365 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3366 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3367 ret->data[i] = arr_elem_conv;
3369 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3371 return (uint64_t)ret;
3373 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3374 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3375 for (size_t i = 0; i < ret.datalen; i++) {
3376 ret.data[i] = NetAddress_clone(&orig->data[i]);
3380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3381 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3382 LDKThirtyTwoBytes a_ref;
3383 CHECK((*env)->GetArrayLength(env, a) == 32);
3384 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3386 LDKThirtyTwoBytes b_ref;
3387 CHECK((*env)->GetArrayLength(env, b) == 32);
3388 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3390 return (uint64_t)ret;
3392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3393 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3394 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3395 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3399 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3400 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3401 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3405 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3408 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3409 CHECK(val->result_ok);
3410 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3411 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3415 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3416 CHECK(!val->result_ok);
3417 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3421 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3422 ret->datalen = (*env)->GetArrayLength(env, elems);
3423 if (ret->datalen == 0) {
3426 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3427 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3428 for (size_t i = 0; i < ret->datalen; i++) {
3429 int64_t arr_elem = java_elems[i];
3430 LDKChannelMonitor arr_elem_conv;
3431 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3432 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3433 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3434 ret->data[i] = arr_elem_conv;
3436 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3438 return (uint64_t)ret;
3440 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3441 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3442 for (size_t i = 0; i < ret.datalen; i++) {
3443 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3447 typedef struct LDKWatch_JCalls {
3448 atomic_size_t refcnt;
3451 jmethodID watch_channel_meth;
3452 jmethodID update_channel_meth;
3453 jmethodID release_pending_monitor_events_meth;
3455 static void LDKWatch_JCalls_free(void* this_arg) {
3456 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3457 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3459 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3460 if (get_jenv_res == JNI_EDETACHED) {
3461 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3463 DO_ASSERT(get_jenv_res == JNI_OK);
3465 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3466 if (get_jenv_res == JNI_EDETACHED) {
3467 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3472 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3473 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3475 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3476 if (get_jenv_res == JNI_EDETACHED) {
3477 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3479 DO_ASSERT(get_jenv_res == JNI_OK);
3481 LDKOutPoint funding_txo_var = funding_txo;
3482 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3483 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3484 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3485 if (funding_txo_var.is_owned) {
3486 funding_txo_ref |= 1;
3488 LDKChannelMonitor monitor_var = monitor;
3489 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3490 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3491 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3492 if (monitor_var.is_owned) {
3495 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3497 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3498 if ((*env)->ExceptionCheck(env)) {
3499 (*env)->ExceptionDescribe(env);
3500 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3502 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3503 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3504 if (get_jenv_res == JNI_EDETACHED) {
3505 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3509 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3510 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3512 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3513 if (get_jenv_res == JNI_EDETACHED) {
3514 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3516 DO_ASSERT(get_jenv_res == JNI_OK);
3518 LDKOutPoint funding_txo_var = funding_txo;
3519 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3520 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3521 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3522 if (funding_txo_var.is_owned) {
3523 funding_txo_ref |= 1;
3525 LDKChannelMonitorUpdate update_var = update;
3526 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3527 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3528 uint64_t update_ref = (uint64_t)update_var.inner;
3529 if (update_var.is_owned) {
3532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3534 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3535 if ((*env)->ExceptionCheck(env)) {
3536 (*env)->ExceptionDescribe(env);
3537 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3539 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3540 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3541 if (get_jenv_res == JNI_EDETACHED) {
3542 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3546 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3547 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3549 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3550 if (get_jenv_res == JNI_EDETACHED) {
3551 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3553 DO_ASSERT(get_jenv_res == JNI_OK);
3555 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3557 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3558 if ((*env)->ExceptionCheck(env)) {
3559 (*env)->ExceptionDescribe(env);
3560 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3562 LDKCVec_MonitorEventZ ret_constr;
3563 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3564 if (ret_constr.datalen > 0)
3565 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3567 ret_constr.data = NULL;
3568 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3569 for (size_t o = 0; o < ret_constr.datalen; o++) {
3570 int64_t ret_conv_14 = ret_vals[o];
3571 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3572 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3573 ret_constr.data[o] = ret_conv_14_conv;
3575 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3576 if (get_jenv_res == JNI_EDETACHED) {
3577 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3581 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3582 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3583 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3585 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3586 jclass c = (*env)->GetObjectClass(env, o);
3588 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3589 atomic_init(&calls->refcnt, 1);
3590 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3591 calls->o = (*env)->NewWeakGlobalRef(env, o);
3592 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3593 CHECK(calls->watch_channel_meth != NULL);
3594 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3595 CHECK(calls->update_channel_meth != NULL);
3596 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3597 CHECK(calls->release_pending_monitor_events_meth != NULL);
3600 .this_arg = (void*) calls,
3601 .watch_channel = watch_channel_LDKWatch_jcall,
3602 .update_channel = update_channel_LDKWatch_jcall,
3603 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3604 .free = LDKWatch_JCalls_free,
3608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3609 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3610 *res_ptr = LDKWatch_init(env, clz, o);
3611 return (uint64_t)res_ptr;
3613 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) {
3614 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3615 LDKOutPoint funding_txo_conv;
3616 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3617 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3618 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3619 LDKChannelMonitor monitor_conv;
3620 monitor_conv.inner = (void*)(monitor & (~1));
3621 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3622 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3623 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3624 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3625 return (uint64_t)ret_conv;
3628 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) {
3629 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3630 LDKOutPoint funding_txo_conv;
3631 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3632 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3633 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3634 LDKChannelMonitorUpdate update_conv;
3635 update_conv.inner = (void*)(update & (~1));
3636 update_conv.is_owned = (update & 1) || (update == 0);
3637 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3638 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3639 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3640 return (uint64_t)ret_conv;
3643 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3644 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3645 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3646 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3647 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3648 for (size_t o = 0; o < ret_var.datalen; o++) {
3649 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3650 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3651 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3652 ret_arr_ptr[o] = ret_conv_14_ref;
3654 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3659 typedef struct LDKBroadcasterInterface_JCalls {
3660 atomic_size_t refcnt;
3663 jmethodID broadcast_transaction_meth;
3664 } LDKBroadcasterInterface_JCalls;
3665 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3666 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3667 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3669 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3670 if (get_jenv_res == JNI_EDETACHED) {
3671 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3673 DO_ASSERT(get_jenv_res == JNI_OK);
3675 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3676 if (get_jenv_res == JNI_EDETACHED) {
3677 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3682 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3683 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3685 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3686 if (get_jenv_res == JNI_EDETACHED) {
3687 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3689 DO_ASSERT(get_jenv_res == JNI_OK);
3691 LDKTransaction tx_var = tx;
3692 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3693 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3694 Transaction_free(tx_var);
3695 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3697 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3698 if ((*env)->ExceptionCheck(env)) {
3699 (*env)->ExceptionDescribe(env);
3700 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3702 if (get_jenv_res == JNI_EDETACHED) {
3703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3706 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3707 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3708 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3710 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3711 jclass c = (*env)->GetObjectClass(env, o);
3713 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3714 atomic_init(&calls->refcnt, 1);
3715 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3716 calls->o = (*env)->NewWeakGlobalRef(env, o);
3717 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3718 CHECK(calls->broadcast_transaction_meth != NULL);
3720 LDKBroadcasterInterface ret = {
3721 .this_arg = (void*) calls,
3722 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3723 .free = LDKBroadcasterInterface_JCalls_free,
3727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3728 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3729 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3730 return (uint64_t)res_ptr;
3732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3733 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3734 LDKTransaction tx_ref;
3735 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3736 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3737 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3738 tx_ref.data_is_owned = true;
3739 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3742 typedef struct LDKKeysInterface_JCalls {
3743 atomic_size_t refcnt;
3746 jmethodID get_node_secret_meth;
3747 jmethodID get_destination_script_meth;
3748 jmethodID get_shutdown_scriptpubkey_meth;
3749 jmethodID get_channel_signer_meth;
3750 jmethodID get_secure_random_bytes_meth;
3751 jmethodID read_chan_signer_meth;
3752 jmethodID sign_invoice_meth;
3753 } LDKKeysInterface_JCalls;
3754 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3755 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3756 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3758 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3759 if (get_jenv_res == JNI_EDETACHED) {
3760 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3762 DO_ASSERT(get_jenv_res == JNI_OK);
3764 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3765 if (get_jenv_res == JNI_EDETACHED) {
3766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3771 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3772 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3774 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3775 if (get_jenv_res == JNI_EDETACHED) {
3776 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3778 DO_ASSERT(get_jenv_res == JNI_OK);
3780 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3782 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3783 if ((*env)->ExceptionCheck(env)) {
3784 (*env)->ExceptionDescribe(env);
3785 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3787 LDKSecretKey ret_ref;
3788 CHECK((*env)->GetArrayLength(env, ret) == 32);
3789 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3790 if (get_jenv_res == JNI_EDETACHED) {
3791 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3795 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3796 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3798 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3799 if (get_jenv_res == JNI_EDETACHED) {
3800 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3802 DO_ASSERT(get_jenv_res == JNI_OK);
3804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3806 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3807 if ((*env)->ExceptionCheck(env)) {
3808 (*env)->ExceptionDescribe(env);
3809 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
3811 LDKCVec_u8Z ret_ref;
3812 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3813 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3814 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3815 if (get_jenv_res == JNI_EDETACHED) {
3816 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3820 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3821 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3823 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3824 if (get_jenv_res == JNI_EDETACHED) {
3825 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3827 DO_ASSERT(get_jenv_res == JNI_OK);
3829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3831 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
3832 if ((*env)->ExceptionCheck(env)) {
3833 (*env)->ExceptionDescribe(env);
3834 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
3836 LDKShutdownScript ret_conv;
3837 ret_conv.inner = (void*)(ret & (~1));
3838 ret_conv.is_owned = (ret & 1) || (ret == 0);
3839 ret_conv = ShutdownScript_clone(&ret_conv);
3840 if (get_jenv_res == JNI_EDETACHED) {
3841 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3845 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3846 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3848 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3849 if (get_jenv_res == JNI_EDETACHED) {
3850 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3852 DO_ASSERT(get_jenv_res == JNI_OK);
3854 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3856 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3857 if ((*env)->ExceptionCheck(env)) {
3858 (*env)->ExceptionDescribe(env);
3859 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
3861 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3862 ret_conv = Sign_clone(&ret_conv);
3863 if (get_jenv_res == JNI_EDETACHED) {
3864 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3868 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3869 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3871 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3872 if (get_jenv_res == JNI_EDETACHED) {
3873 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3875 DO_ASSERT(get_jenv_res == JNI_OK);
3877 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3879 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3880 if ((*env)->ExceptionCheck(env)) {
3881 (*env)->ExceptionDescribe(env);
3882 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
3884 LDKThirtyTwoBytes ret_ref;
3885 CHECK((*env)->GetArrayLength(env, ret) == 32);
3886 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3887 if (get_jenv_res == JNI_EDETACHED) {
3888 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3892 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3893 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3895 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3896 if (get_jenv_res == JNI_EDETACHED) {
3897 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3899 DO_ASSERT(get_jenv_res == JNI_OK);
3901 LDKu8slice reader_var = reader;
3902 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3903 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3904 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3906 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3907 if ((*env)->ExceptionCheck(env)) {
3908 (*env)->ExceptionDescribe(env);
3909 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
3911 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3912 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3913 if (get_jenv_res == JNI_EDETACHED) {
3914 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3918 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3919 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3921 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3922 if (get_jenv_res == JNI_EDETACHED) {
3923 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3925 DO_ASSERT(get_jenv_res == JNI_OK);
3927 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3928 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3929 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3930 CVec_u8Z_free(invoice_preimage_var);
3931 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3933 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3934 if ((*env)->ExceptionCheck(env)) {
3935 (*env)->ExceptionDescribe(env);
3936 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
3938 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3939 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3940 if (get_jenv_res == JNI_EDETACHED) {
3941 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3945 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3946 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3947 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3949 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3950 jclass c = (*env)->GetObjectClass(env, o);
3952 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3953 atomic_init(&calls->refcnt, 1);
3954 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3955 calls->o = (*env)->NewWeakGlobalRef(env, o);
3956 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3957 CHECK(calls->get_node_secret_meth != NULL);
3958 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3959 CHECK(calls->get_destination_script_meth != NULL);
3960 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
3961 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
3962 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3963 CHECK(calls->get_channel_signer_meth != NULL);
3964 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3965 CHECK(calls->get_secure_random_bytes_meth != NULL);
3966 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3967 CHECK(calls->read_chan_signer_meth != NULL);
3968 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3969 CHECK(calls->sign_invoice_meth != NULL);
3971 LDKKeysInterface ret = {
3972 .this_arg = (void*) calls,
3973 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3974 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3975 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3976 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3977 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3978 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3979 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3980 .free = LDKKeysInterface_JCalls_free,
3984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3985 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3986 *res_ptr = LDKKeysInterface_init(env, clz, o);
3987 return (uint64_t)res_ptr;
3989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3990 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3991 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3997 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3998 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3999 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4000 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4001 CVec_u8Z_free(ret_var);
4005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4006 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4007 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4010 uint64_t ret_ref = (uint64_t)ret_var.inner;
4011 if (ret_var.is_owned) {
4017 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) {
4018 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4019 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
4020 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4021 return (uint64_t)ret;
4024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4025 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4026 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4027 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4032 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4033 LDKu8slice reader_ref;
4034 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4035 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4036 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4037 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4038 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4039 return (uint64_t)ret_conv;
4042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4043 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4044 LDKCVec_u8Z invoice_preimage_ref;
4045 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4046 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4047 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4048 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4049 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4050 return (uint64_t)ret_conv;
4053 typedef struct LDKFeeEstimator_JCalls {
4054 atomic_size_t refcnt;
4057 jmethodID get_est_sat_per_1000_weight_meth;
4058 } LDKFeeEstimator_JCalls;
4059 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4060 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4061 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4063 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4064 if (get_jenv_res == JNI_EDETACHED) {
4065 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4067 DO_ASSERT(get_jenv_res == JNI_OK);
4069 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4070 if (get_jenv_res == JNI_EDETACHED) {
4071 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4076 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4077 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4079 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4080 if (get_jenv_res == JNI_EDETACHED) {
4081 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4083 DO_ASSERT(get_jenv_res == JNI_OK);
4085 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4086 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4088 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4089 if ((*env)->ExceptionCheck(env)) {
4090 (*env)->ExceptionDescribe(env);
4091 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4093 if (get_jenv_res == JNI_EDETACHED) {
4094 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4098 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4099 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4100 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4102 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4103 jclass c = (*env)->GetObjectClass(env, o);
4105 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4106 atomic_init(&calls->refcnt, 1);
4107 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4108 calls->o = (*env)->NewWeakGlobalRef(env, o);
4109 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4110 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4112 LDKFeeEstimator ret = {
4113 .this_arg = (void*) calls,
4114 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4115 .free = LDKFeeEstimator_JCalls_free,
4119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4120 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4121 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4122 return (uint64_t)res_ptr;
4124 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) {
4125 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4126 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4127 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4131 typedef struct LDKLogger_JCalls {
4132 atomic_size_t refcnt;
4137 static void LDKLogger_JCalls_free(void* this_arg) {
4138 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4139 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4141 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4142 if (get_jenv_res == JNI_EDETACHED) {
4143 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4145 DO_ASSERT(get_jenv_res == JNI_OK);
4147 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4148 if (get_jenv_res == JNI_EDETACHED) {
4149 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4154 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4155 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4157 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4158 if (get_jenv_res == JNI_EDETACHED) {
4159 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4161 DO_ASSERT(get_jenv_res == JNI_OK);
4163 const char* record_str = record;
4164 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4165 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4167 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4168 if ((*env)->ExceptionCheck(env)) {
4169 (*env)->ExceptionDescribe(env);
4170 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4172 if (get_jenv_res == JNI_EDETACHED) {
4173 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4176 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4177 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4178 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4180 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4181 jclass c = (*env)->GetObjectClass(env, o);
4183 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4184 atomic_init(&calls->refcnt, 1);
4185 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4186 calls->o = (*env)->NewWeakGlobalRef(env, o);
4187 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4188 CHECK(calls->log_meth != NULL);
4191 .this_arg = (void*) calls,
4192 .log = log_LDKLogger_jcall,
4193 .free = LDKLogger_JCalls_free,
4197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4198 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4199 *res_ptr = LDKLogger_init(env, clz, o);
4200 return (uint64_t)res_ptr;
4202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4203 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4204 LDKThirtyTwoBytes a_ref;
4205 CHECK((*env)->GetArrayLength(env, a) == 32);
4206 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4208 LDKChannelManager b_conv;
4209 b_conv.inner = (void*)(b & (~1));
4210 b_conv.is_owned = (b & 1) || (b == 0);
4211 // Warning: we need a move here but no clone is available for LDKChannelManager
4213 return (uint64_t)ret;
4215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4216 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4217 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4218 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4222 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4223 LDKChannelManager b_var = tuple->b;
4224 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4230 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4233 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4234 CHECK(val->result_ok);
4235 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4239 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4240 CHECK(!val->result_ok);
4241 LDKDecodeError err_var = (*val->contents.err);
4242 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4243 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4244 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4248 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4251 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4252 CHECK(val->result_ok);
4253 LDKChannelConfig res_var = (*val->contents.result);
4254 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4255 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4256 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4260 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4261 CHECK(!val->result_ok);
4262 LDKDecodeError err_var = (*val->contents.err);
4263 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4264 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4265 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4269 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4272 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4273 CHECK(val->result_ok);
4274 LDKOutPoint res_var = (*val->contents.result);
4275 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4281 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4282 CHECK(!val->result_ok);
4283 LDKDecodeError err_var = (*val->contents.err);
4284 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4285 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4286 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4290 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4292 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4293 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4294 CHECK(val->result_ok);
4295 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4299 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4300 CHECK(!val->result_ok);
4301 return *val->contents.err;
4303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4304 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4307 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4308 CHECK(val->result_ok);
4309 LDKInvoice res_var = (*val->contents.result);
4310 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4311 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4312 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4316 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4317 CHECK(!val->result_ok);
4318 return *val->contents.err;
4320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4321 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4324 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4325 CHECK(val->result_ok);
4326 LDKSignedRawInvoice res_var = (*val->contents.result);
4327 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4333 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4334 CHECK(!val->result_ok);
4335 return *val->contents.err;
4337 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) {
4338 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4339 LDKRawInvoice a_conv;
4340 a_conv.inner = (void*)(a & (~1));
4341 a_conv.is_owned = (a & 1) || (a == 0);
4342 a_conv = RawInvoice_clone(&a_conv);
4344 LDKThirtyTwoBytes b_ref;
4345 CHECK((*env)->GetArrayLength(env, b) == 32);
4346 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4348 LDKInvoiceSignature c_conv;
4349 c_conv.inner = (void*)(c & (~1));
4350 c_conv.is_owned = (c & 1) || (c == 0);
4351 c_conv = InvoiceSignature_clone(&c_conv);
4353 return (uint64_t)ret;
4355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4356 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4357 LDKRawInvoice a_var = tuple->a;
4358 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4364 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4365 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4366 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4370 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4371 LDKInvoiceSignature c_var = tuple->c;
4372 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4373 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4374 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4378 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4381 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4382 CHECK(val->result_ok);
4383 LDKPayeePubKey res_var = (*val->contents.result);
4384 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4385 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4386 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4390 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4391 CHECK(!val->result_ok);
4392 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4396 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4397 ret->datalen = (*env)->GetArrayLength(env, elems);
4398 if (ret->datalen == 0) {
4401 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4402 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4403 for (size_t i = 0; i < ret->datalen; i++) {
4404 int64_t arr_elem = java_elems[i];
4405 LDKPrivateRoute arr_elem_conv;
4406 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4407 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4408 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4409 ret->data[i] = arr_elem_conv;
4411 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4413 return (uint64_t)ret;
4415 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4416 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4417 for (size_t i = 0; i < ret.datalen; i++) {
4418 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4423 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4426 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4427 CHECK(val->result_ok);
4428 LDKPositiveTimestamp res_var = (*val->contents.result);
4429 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4430 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4431 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4434 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4435 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4436 CHECK(!val->result_ok);
4437 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4441 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4444 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4445 CHECK(val->result_ok);
4446 return *val->contents.result;
4448 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4449 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4450 CHECK(!val->result_ok);
4451 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4455 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4458 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4459 CHECK(val->result_ok);
4460 LDKInvoice res_var = (*val->contents.result);
4461 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4466 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4467 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4468 CHECK(!val->result_ok);
4469 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4473 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4476 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4477 CHECK(val->result_ok);
4478 LDKDescription res_var = (*val->contents.result);
4479 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4480 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4481 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4484 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4485 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4486 CHECK(!val->result_ok);
4487 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4491 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4494 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4495 CHECK(val->result_ok);
4496 LDKExpiryTime res_var = (*val->contents.result);
4497 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4498 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4499 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4503 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4504 CHECK(!val->result_ok);
4505 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4509 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4512 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4513 CHECK(val->result_ok);
4514 LDKPrivateRoute res_var = (*val->contents.result);
4515 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4516 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4517 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4521 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4522 CHECK(!val->result_ok);
4523 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4527 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4529 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4530 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4531 CHECK(val->result_ok);
4532 LDKStr res_str = (*val->contents.result);
4533 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4536 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4537 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4538 CHECK(!val->result_ok);
4539 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4543 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4546 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4547 CHECK(val->result_ok);
4548 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4549 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4550 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4551 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4555 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4556 CHECK(!val->result_ok);
4557 LDKDecodeError err_var = (*val->contents.err);
4558 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4559 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4560 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4564 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4567 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4568 CHECK(val->result_ok);
4569 LDKHTLCUpdate res_var = (*val->contents.result);
4570 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4571 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4572 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4576 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4577 CHECK(!val->result_ok);
4578 LDKDecodeError err_var = (*val->contents.err);
4579 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4580 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4581 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4585 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4588 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4589 CHECK(val->result_ok);
4590 return *val->contents.result;
4592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4593 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4594 CHECK(!val->result_ok);
4595 LDKMonitorUpdateError err_var = (*val->contents.err);
4596 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4597 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4598 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4602 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4604 a_conv.inner = (void*)(a & (~1));
4605 a_conv.is_owned = (a & 1) || (a == 0);
4606 a_conv = OutPoint_clone(&a_conv);
4609 b_ref.datalen = (*env)->GetArrayLength(env, b);
4610 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4611 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4613 return (uint64_t)ret;
4615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4616 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4617 LDKOutPoint a_var = tuple->a;
4618 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4619 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4620 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4624 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4625 LDKCVec_u8Z b_var = tuple->b;
4626 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4627 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4631 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4634 b_ref.datalen = (*env)->GetArrayLength(env, b);
4635 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4636 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4638 return (uint64_t)ret;
4640 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4641 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4645 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4646 LDKCVec_u8Z b_var = tuple->b;
4647 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4648 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4652 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4653 ret->datalen = (*env)->GetArrayLength(env, elems);
4654 if (ret->datalen == 0) {
4657 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4658 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4659 for (size_t i = 0; i < ret->datalen; i++) {
4660 int64_t arr_elem = java_elems[i];
4661 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4662 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4663 ret->data[i] = arr_elem_conv;
4665 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4667 return (uint64_t)ret;
4669 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4670 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4671 for (size_t i = 0; i < ret.datalen; i++) {
4672 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4677 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4678 LDKThirtyTwoBytes a_ref;
4679 CHECK((*env)->GetArrayLength(env, a) == 32);
4680 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4682 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4683 b_constr.datalen = (*env)->GetArrayLength(env, b);
4684 if (b_constr.datalen > 0)
4685 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4687 b_constr.data = NULL;
4688 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4689 for (size_t b = 0; b < b_constr.datalen; b++) {
4690 int64_t b_conv_27 = b_vals[b];
4691 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4692 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4693 b_constr.data[b] = b_conv_27_conv;
4695 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4697 return (uint64_t)ret;
4699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4700 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4701 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4702 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4705 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4706 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4707 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4708 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4709 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4710 for (size_t b = 0; b < b_var.datalen; b++) {
4711 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4712 b_arr_ptr[b] = b_conv_27_ref;
4714 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4718 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4719 ret->datalen = (*env)->GetArrayLength(env, elems);
4720 if (ret->datalen == 0) {
4723 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4724 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4725 for (size_t i = 0; i < ret->datalen; i++) {
4726 int64_t arr_elem = java_elems[i];
4727 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4728 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4729 ret->data[i] = arr_elem_conv;
4731 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4733 return (uint64_t)ret;
4735 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4736 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 };
4737 for (size_t i = 0; i < ret.datalen; i++) {
4738 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4742 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
4743 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
4744 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
4745 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
4746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
4747 LDKPaymentPurpose_InvoicePayment_class =
4748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
4749 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
4750 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
4751 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
4752 LDKPaymentPurpose_SpontaneousPayment_class =
4753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
4754 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
4755 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
4756 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
4758 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4759 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
4761 case LDKPaymentPurpose_InvoicePayment: {
4762 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4763 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
4764 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4765 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
4766 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
4768 case LDKPaymentPurpose_SpontaneousPayment: {
4769 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
4770 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
4771 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
4776 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4777 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4778 static jclass LDKEvent_PaymentReceived_class = NULL;
4779 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4780 static jclass LDKEvent_PaymentSent_class = NULL;
4781 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4782 static jclass LDKEvent_PaymentFailed_class = NULL;
4783 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4784 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4785 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4786 static jclass LDKEvent_SpendableOutputs_class = NULL;
4787 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4788 static jclass LDKEvent_PaymentForwarded_class = NULL;
4789 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
4790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4791 LDKEvent_FundingGenerationReady_class =
4792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4793 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4794 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4795 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4796 LDKEvent_PaymentReceived_class =
4797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4798 CHECK(LDKEvent_PaymentReceived_class != NULL);
4799 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
4800 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4801 LDKEvent_PaymentSent_class =
4802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4803 CHECK(LDKEvent_PaymentSent_class != NULL);
4804 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4805 CHECK(LDKEvent_PaymentSent_meth != NULL);
4806 LDKEvent_PaymentFailed_class =
4807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4808 CHECK(LDKEvent_PaymentFailed_class != NULL);
4809 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4810 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4811 LDKEvent_PendingHTLCsForwardable_class =
4812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4813 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4814 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4815 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4816 LDKEvent_SpendableOutputs_class =
4817 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4818 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4819 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4820 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4821 LDKEvent_PaymentForwarded_class =
4822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
4823 CHECK(LDKEvent_PaymentForwarded_class != NULL);
4824 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
4825 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
4827 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4828 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4830 case LDKEvent_FundingGenerationReady: {
4831 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4832 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4833 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4834 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4835 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4836 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);
4838 case LDKEvent_PaymentReceived: {
4839 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4840 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4841 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
4842 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
4844 case LDKEvent_PaymentSent: {
4845 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4846 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4847 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4849 case LDKEvent_PaymentFailed: {
4850 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4851 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4852 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4854 case LDKEvent_PendingHTLCsForwardable: {
4855 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4857 case LDKEvent_SpendableOutputs: {
4858 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4859 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4860 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4861 for (size_t b = 0; b < outputs_var.datalen; b++) {
4862 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4863 outputs_arr_ptr[b] = outputs_conv_27_ref;
4865 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4866 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4868 case LDKEvent_PaymentForwarded: {
4869 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
4870 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
4875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4876 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4877 ret->datalen = (*env)->GetArrayLength(env, elems);
4878 if (ret->datalen == 0) {
4881 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4882 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4883 for (size_t i = 0; i < ret->datalen; i++) {
4884 int64_t arr_elem = java_elems[i];
4885 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4886 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4887 ret->data[i] = arr_elem_conv;
4889 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4891 return (uint64_t)ret;
4893 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4894 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4895 for (size_t i = 0; i < ret.datalen; i++) {
4896 ret.data[i] = Event_clone(&orig->data[i]);
4900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4901 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4903 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4904 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4906 return (uint64_t)ret;
4908 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4909 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4913 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4914 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4915 return (uint64_t)b_ref;
4917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4918 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4919 ret->datalen = (*env)->GetArrayLength(env, elems);
4920 if (ret->datalen == 0) {
4923 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4924 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4925 for (size_t i = 0; i < ret->datalen; i++) {
4926 int64_t arr_elem = java_elems[i];
4927 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4928 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4929 ret->data[i] = arr_elem_conv;
4931 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4933 return (uint64_t)ret;
4935 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4936 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4937 for (size_t i = 0; i < ret.datalen; i++) {
4938 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4943 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4944 LDKThirtyTwoBytes a_ref;
4945 CHECK((*env)->GetArrayLength(env, a) == 32);
4946 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4948 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4949 b_constr.datalen = (*env)->GetArrayLength(env, b);
4950 if (b_constr.datalen > 0)
4951 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4953 b_constr.data = NULL;
4954 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4955 for (size_t a = 0; a < b_constr.datalen; a++) {
4956 int64_t b_conv_26 = b_vals[a];
4957 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4958 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4959 b_constr.data[a] = b_conv_26_conv;
4961 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4963 return (uint64_t)ret;
4965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4966 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4967 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4968 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4971 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4972 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4973 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4974 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4975 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4976 for (size_t a = 0; a < b_var.datalen; a++) {
4977 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4978 b_arr_ptr[a] = b_conv_26_ref;
4980 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4984 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4985 ret->datalen = (*env)->GetArrayLength(env, elems);
4986 if (ret->datalen == 0) {
4989 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4990 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4991 for (size_t i = 0; i < ret->datalen; i++) {
4992 int64_t arr_elem = java_elems[i];
4993 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4994 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4995 ret->data[i] = arr_elem_conv;
4997 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4999 return (uint64_t)ret;
5001 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5002 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 };
5003 for (size_t i = 0; i < ret.datalen; i++) {
5004 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5009 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5012 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5013 CHECK(val->result_ok);
5014 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
5017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5018 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5019 CHECK(!val->result_ok);
5020 LDKDecodeError err_var = (*val->contents.err);
5021 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5022 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5023 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5027 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5030 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5031 CHECK(val->result_ok);
5032 return *val->contents.result;
5034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5035 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5036 CHECK(!val->result_ok);
5037 LDKLightningError err_var = (*val->contents.err);
5038 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5039 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5040 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5043 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) {
5044 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5045 LDKChannelAnnouncement a_conv;
5046 a_conv.inner = (void*)(a & (~1));
5047 a_conv.is_owned = (a & 1) || (a == 0);
5048 a_conv = ChannelAnnouncement_clone(&a_conv);
5050 LDKChannelUpdate b_conv;
5051 b_conv.inner = (void*)(b & (~1));
5052 b_conv.is_owned = (b & 1) || (b == 0);
5053 b_conv = ChannelUpdate_clone(&b_conv);
5055 LDKChannelUpdate c_conv;
5056 c_conv.inner = (void*)(c & (~1));
5057 c_conv.is_owned = (c & 1) || (c == 0);
5058 c_conv = ChannelUpdate_clone(&c_conv);
5060 return (uint64_t)ret;
5062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5063 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5064 LDKChannelAnnouncement a_var = tuple->a;
5065 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5066 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5067 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
5070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5071 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5072 LDKChannelUpdate b_var = tuple->b;
5073 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
5078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
5079 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5080 LDKChannelUpdate c_var = tuple->c;
5081 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5082 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5083 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
5086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5087 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5088 ret->datalen = (*env)->GetArrayLength(env, elems);
5089 if (ret->datalen == 0) {
5092 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5093 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5094 for (size_t i = 0; i < ret->datalen; i++) {
5095 int64_t arr_elem = java_elems[i];
5096 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5097 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5098 ret->data[i] = arr_elem_conv;
5100 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5102 return (uint64_t)ret;
5104 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5105 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5106 for (size_t i = 0; i < ret.datalen; i++) {
5107 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5112 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5113 ret->datalen = (*env)->GetArrayLength(env, elems);
5114 if (ret->datalen == 0) {
5117 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5118 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5119 for (size_t i = 0; i < ret->datalen; i++) {
5120 int64_t arr_elem = java_elems[i];
5121 LDKNodeAnnouncement arr_elem_conv;
5122 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5123 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5124 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5125 ret->data[i] = arr_elem_conv;
5127 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5129 return (uint64_t)ret;
5131 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5132 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5133 for (size_t i = 0; i < ret.datalen; i++) {
5134 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5139 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5142 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5143 CHECK(val->result_ok);
5144 return *val->contents.result;
5146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5147 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5148 CHECK(!val->result_ok);
5149 LDKLightningError 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_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5156 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5159 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5160 CHECK(val->result_ok);
5161 LDKCVec_u8Z res_var = (*val->contents.result);
5162 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5163 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5167 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5168 CHECK(!val->result_ok);
5169 LDKPeerHandleError err_var = (*val->contents.err);
5170 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5171 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5172 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5176 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5179 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5180 CHECK(val->result_ok);
5181 return *val->contents.result;
5183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5184 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5185 CHECK(!val->result_ok);
5186 LDKPeerHandleError err_var = (*val->contents.err);
5187 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5188 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5189 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5193 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5196 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5197 CHECK(val->result_ok);
5198 return *val->contents.result;
5200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5201 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5202 CHECK(!val->result_ok);
5203 LDKPeerHandleError err_var = (*val->contents.err);
5204 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5205 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5206 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5210 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5213 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5214 CHECK(val->result_ok);
5215 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5216 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5217 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5218 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5222 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5223 CHECK(!val->result_ok);
5224 LDKDecodeError err_var = (*val->contents.err);
5225 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5231 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5234 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5235 CHECK(val->result_ok);
5236 LDKChannelInfo res_var = (*val->contents.result);
5237 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5238 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5239 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5243 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5244 CHECK(!val->result_ok);
5245 LDKDecodeError err_var = (*val->contents.err);
5246 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5247 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5248 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5252 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5255 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5256 CHECK(val->result_ok);
5257 LDKRoutingFees res_var = (*val->contents.result);
5258 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5259 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5260 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5264 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5265 CHECK(!val->result_ok);
5266 LDKDecodeError err_var = (*val->contents.err);
5267 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5268 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5269 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5273 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5276 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5277 CHECK(val->result_ok);
5278 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5279 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5280 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5281 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5285 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5286 CHECK(!val->result_ok);
5287 LDKDecodeError err_var = (*val->contents.err);
5288 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5289 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5290 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5294 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5295 ret->datalen = (*env)->GetArrayLength(env, elems);
5296 if (ret->datalen == 0) {
5299 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5300 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5301 for (size_t i = 0; i < ret->datalen; i++) {
5302 ret->data[i] = java_elems[i];
5304 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5306 return (uint64_t)ret;
5308 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5309 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5310 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5314 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5317 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5318 CHECK(val->result_ok);
5319 LDKNodeInfo res_var = (*val->contents.result);
5320 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5321 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5322 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5326 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5327 CHECK(!val->result_ok);
5328 LDKDecodeError err_var = (*val->contents.err);
5329 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5330 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5331 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5335 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5338 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5339 CHECK(val->result_ok);
5340 LDKNetworkGraph res_var = (*val->contents.result);
5341 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5342 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5343 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5347 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5348 CHECK(!val->result_ok);
5349 LDKDecodeError err_var = (*val->contents.err);
5350 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5351 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5352 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5356 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5359 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5360 CHECK(val->result_ok);
5361 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5364 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5365 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5366 CHECK(!val->result_ok);
5367 return *val->contents.err;
5369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5370 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5373 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5374 CHECK(val->result_ok);
5375 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5376 *res_conv = (*val->contents.result);
5377 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5378 return (uint64_t)res_conv;
5380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5381 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5382 CHECK(!val->result_ok);
5383 LDKDecodeError err_var = (*val->contents.err);
5384 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5385 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5386 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5390 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5393 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5394 CHECK(val->result_ok);
5395 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5399 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5400 CHECK(!val->result_ok);
5401 LDKDecodeError err_var = (*val->contents.err);
5402 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5403 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5404 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5408 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5409 ret->datalen = (*env)->GetArrayLength(env, elems);
5410 if (ret->datalen == 0) {
5413 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5414 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5415 for (size_t i = 0; i < ret->datalen; i++) {
5416 int64_t arr_elem = java_elems[i];
5417 LDKUpdateAddHTLC arr_elem_conv;
5418 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5419 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5420 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5421 ret->data[i] = arr_elem_conv;
5423 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5425 return (uint64_t)ret;
5427 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5428 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5429 for (size_t i = 0; i < ret.datalen; i++) {
5430 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5435 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5436 ret->datalen = (*env)->GetArrayLength(env, elems);
5437 if (ret->datalen == 0) {
5440 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5441 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5442 for (size_t i = 0; i < ret->datalen; i++) {
5443 int64_t arr_elem = java_elems[i];
5444 LDKUpdateFulfillHTLC arr_elem_conv;
5445 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5446 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5447 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5448 ret->data[i] = arr_elem_conv;
5450 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5452 return (uint64_t)ret;
5454 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5455 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5456 for (size_t i = 0; i < ret.datalen; i++) {
5457 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5462 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5463 ret->datalen = (*env)->GetArrayLength(env, elems);
5464 if (ret->datalen == 0) {
5467 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5468 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5469 for (size_t i = 0; i < ret->datalen; i++) {
5470 int64_t arr_elem = java_elems[i];
5471 LDKUpdateFailHTLC arr_elem_conv;
5472 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5473 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5474 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5475 ret->data[i] = arr_elem_conv;
5477 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5479 return (uint64_t)ret;
5481 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5482 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5483 for (size_t i = 0; i < ret.datalen; i++) {
5484 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5489 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5490 ret->datalen = (*env)->GetArrayLength(env, elems);
5491 if (ret->datalen == 0) {
5494 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5495 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5496 for (size_t i = 0; i < ret->datalen; i++) {
5497 int64_t arr_elem = java_elems[i];
5498 LDKUpdateFailMalformedHTLC arr_elem_conv;
5499 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5500 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5501 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5502 ret->data[i] = arr_elem_conv;
5504 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5506 return (uint64_t)ret;
5508 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5509 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5510 for (size_t i = 0; i < ret.datalen; i++) {
5511 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5516 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5519 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5520 CHECK(val->result_ok);
5521 LDKAcceptChannel res_var = (*val->contents.result);
5522 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5523 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5524 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5528 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5529 CHECK(!val->result_ok);
5530 LDKDecodeError err_var = (*val->contents.err);
5531 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5532 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5533 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5537 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5540 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5541 CHECK(val->result_ok);
5542 LDKAnnouncementSignatures res_var = (*val->contents.result);
5543 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5544 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5545 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5549 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5550 CHECK(!val->result_ok);
5551 LDKDecodeError err_var = (*val->contents.err);
5552 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5553 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5554 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5558 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5561 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5562 CHECK(val->result_ok);
5563 LDKChannelReestablish res_var = (*val->contents.result);
5564 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5565 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5566 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5570 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5571 CHECK(!val->result_ok);
5572 LDKDecodeError err_var = (*val->contents.err);
5573 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5574 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5575 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5579 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5582 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5583 CHECK(val->result_ok);
5584 LDKClosingSigned res_var = (*val->contents.result);
5585 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5586 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5587 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5591 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5592 CHECK(!val->result_ok);
5593 LDKDecodeError err_var = (*val->contents.err);
5594 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5595 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5596 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5600 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
5602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5603 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5604 CHECK(val->result_ok);
5605 LDKClosingSignedFeeRange res_var = (*val->contents.result);
5606 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5607 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5608 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5612 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5613 CHECK(!val->result_ok);
5614 LDKDecodeError err_var = (*val->contents.err);
5615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5617 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5621 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5624 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5625 CHECK(val->result_ok);
5626 LDKCommitmentSigned res_var = (*val->contents.result);
5627 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5628 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5629 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5633 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5634 CHECK(!val->result_ok);
5635 LDKDecodeError err_var = (*val->contents.err);
5636 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5637 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5638 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5642 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5645 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5646 CHECK(val->result_ok);
5647 LDKFundingCreated res_var = (*val->contents.result);
5648 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5649 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5650 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5654 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5655 CHECK(!val->result_ok);
5656 LDKDecodeError err_var = (*val->contents.err);
5657 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5658 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5659 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5663 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5666 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5667 CHECK(val->result_ok);
5668 LDKFundingSigned res_var = (*val->contents.result);
5669 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5670 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5671 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5675 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5676 CHECK(!val->result_ok);
5677 LDKDecodeError err_var = (*val->contents.err);
5678 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5679 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5680 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5684 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5687 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5688 CHECK(val->result_ok);
5689 LDKFundingLocked res_var = (*val->contents.result);
5690 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5691 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5692 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5696 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5697 CHECK(!val->result_ok);
5698 LDKDecodeError err_var = (*val->contents.err);
5699 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5700 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5701 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5705 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5708 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5709 CHECK(val->result_ok);
5710 LDKInit res_var = (*val->contents.result);
5711 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5712 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5713 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5717 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5718 CHECK(!val->result_ok);
5719 LDKDecodeError err_var = (*val->contents.err);
5720 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5721 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5722 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5726 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5729 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5730 CHECK(val->result_ok);
5731 LDKOpenChannel res_var = (*val->contents.result);
5732 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5733 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5734 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5738 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5739 CHECK(!val->result_ok);
5740 LDKDecodeError err_var = (*val->contents.err);
5741 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5742 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5743 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5747 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5750 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5751 CHECK(val->result_ok);
5752 LDKRevokeAndACK res_var = (*val->contents.result);
5753 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5754 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5755 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5759 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5760 CHECK(!val->result_ok);
5761 LDKDecodeError err_var = (*val->contents.err);
5762 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5763 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5764 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5768 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5771 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5772 CHECK(val->result_ok);
5773 LDKShutdown res_var = (*val->contents.result);
5774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5776 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5780 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5781 CHECK(!val->result_ok);
5782 LDKDecodeError err_var = (*val->contents.err);
5783 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5784 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5785 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5789 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5792 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5793 CHECK(val->result_ok);
5794 LDKUpdateFailHTLC res_var = (*val->contents.result);
5795 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5796 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5797 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5801 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5802 CHECK(!val->result_ok);
5803 LDKDecodeError err_var = (*val->contents.err);
5804 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5805 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5806 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5810 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5813 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5814 CHECK(val->result_ok);
5815 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5816 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5817 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5818 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5822 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5823 CHECK(!val->result_ok);
5824 LDKDecodeError err_var = (*val->contents.err);
5825 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5826 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5827 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5831 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5834 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5835 CHECK(val->result_ok);
5836 LDKUpdateFee res_var = (*val->contents.result);
5837 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5838 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5839 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5843 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5844 CHECK(!val->result_ok);
5845 LDKDecodeError err_var = (*val->contents.err);
5846 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5847 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5848 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5852 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5855 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5856 CHECK(val->result_ok);
5857 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5858 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5859 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5860 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5864 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5865 CHECK(!val->result_ok);
5866 LDKDecodeError err_var = (*val->contents.err);
5867 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5868 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5869 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5873 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5876 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5877 CHECK(val->result_ok);
5878 LDKUpdateAddHTLC res_var = (*val->contents.result);
5879 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5880 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5881 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5885 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5886 CHECK(!val->result_ok);
5887 LDKDecodeError err_var = (*val->contents.err);
5888 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5889 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5890 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5894 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5897 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5898 CHECK(val->result_ok);
5899 LDKPing res_var = (*val->contents.result);
5900 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5901 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5902 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5906 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5907 CHECK(!val->result_ok);
5908 LDKDecodeError err_var = (*val->contents.err);
5909 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5910 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5911 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5915 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5918 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5919 CHECK(val->result_ok);
5920 LDKPong res_var = (*val->contents.result);
5921 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5922 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5923 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5927 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5928 CHECK(!val->result_ok);
5929 LDKDecodeError err_var = (*val->contents.err);
5930 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5931 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5932 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5936 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5939 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5940 CHECK(val->result_ok);
5941 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5942 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5943 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5944 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5948 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5949 CHECK(!val->result_ok);
5950 LDKDecodeError err_var = (*val->contents.err);
5951 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5952 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5953 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5957 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5960 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5961 CHECK(val->result_ok);
5962 LDKChannelAnnouncement res_var = (*val->contents.result);
5963 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5964 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5965 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5969 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5970 CHECK(!val->result_ok);
5971 LDKDecodeError err_var = (*val->contents.err);
5972 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5973 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5974 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5978 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5981 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5982 CHECK(val->result_ok);
5983 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5984 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5985 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5986 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5990 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5991 CHECK(!val->result_ok);
5992 LDKDecodeError err_var = (*val->contents.err);
5993 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5994 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5995 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5999 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6002 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6003 CHECK(val->result_ok);
6004 LDKChannelUpdate res_var = (*val->contents.result);
6005 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6006 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6007 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6011 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6012 CHECK(!val->result_ok);
6013 LDKDecodeError err_var = (*val->contents.err);
6014 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6015 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6016 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6020 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6023 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6024 CHECK(val->result_ok);
6025 LDKErrorMessage res_var = (*val->contents.result);
6026 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6027 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6028 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6032 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6033 CHECK(!val->result_ok);
6034 LDKDecodeError err_var = (*val->contents.err);
6035 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6036 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6037 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6041 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6044 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6045 CHECK(val->result_ok);
6046 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6047 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6048 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6049 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6053 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6054 CHECK(!val->result_ok);
6055 LDKDecodeError err_var = (*val->contents.err);
6056 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6057 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6058 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6062 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6065 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6066 CHECK(val->result_ok);
6067 LDKNodeAnnouncement res_var = (*val->contents.result);
6068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6070 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6074 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6075 CHECK(!val->result_ok);
6076 LDKDecodeError err_var = (*val->contents.err);
6077 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6078 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6079 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6083 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6086 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6087 CHECK(val->result_ok);
6088 LDKQueryShortChannelIds res_var = (*val->contents.result);
6089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6095 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6096 CHECK(!val->result_ok);
6097 LDKDecodeError err_var = (*val->contents.err);
6098 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6099 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6100 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6104 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6107 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6108 CHECK(val->result_ok);
6109 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6116 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6117 CHECK(!val->result_ok);
6118 LDKDecodeError err_var = (*val->contents.err);
6119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6125 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6128 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6129 CHECK(val->result_ok);
6130 LDKQueryChannelRange res_var = (*val->contents.result);
6131 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6132 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6133 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6137 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6138 CHECK(!val->result_ok);
6139 LDKDecodeError err_var = (*val->contents.err);
6140 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6141 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6142 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6146 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
6148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6149 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6150 CHECK(val->result_ok);
6151 LDKReplyChannelRange res_var = (*val->contents.result);
6152 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6153 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6154 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6158 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6159 CHECK(!val->result_ok);
6160 LDKDecodeError err_var = (*val->contents.err);
6161 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6162 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6163 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6167 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
6169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6170 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6171 CHECK(val->result_ok);
6172 LDKGossipTimestampFilter res_var = (*val->contents.result);
6173 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6174 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6175 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6179 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6180 CHECK(!val->result_ok);
6181 LDKDecodeError err_var = (*val->contents.err);
6182 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6183 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6184 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6187 static jclass LDKSignOrCreationError_SignError_class = NULL;
6188 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
6189 static jclass LDKSignOrCreationError_CreationError_class = NULL;
6190 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
6191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
6192 LDKSignOrCreationError_SignError_class =
6193 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
6194 CHECK(LDKSignOrCreationError_SignError_class != NULL);
6195 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
6196 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
6197 LDKSignOrCreationError_CreationError_class =
6198 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6199 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6200 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6201 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6203 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6204 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6206 case LDKSignOrCreationError_SignError: {
6207 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6209 case LDKSignOrCreationError_CreationError: {
6210 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6211 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6217 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6220 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6221 CHECK(val->result_ok);
6222 LDKInvoice res_var = (*val->contents.result);
6223 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6224 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6225 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6229 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6230 CHECK(!val->result_ok);
6231 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6234 typedef struct LDKMessageSendEventsProvider_JCalls {
6235 atomic_size_t refcnt;
6238 jmethodID get_and_clear_pending_msg_events_meth;
6239 } LDKMessageSendEventsProvider_JCalls;
6240 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6241 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6242 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6244 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6245 if (get_jenv_res == JNI_EDETACHED) {
6246 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6248 DO_ASSERT(get_jenv_res == JNI_OK);
6250 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6251 if (get_jenv_res == JNI_EDETACHED) {
6252 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6257 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6258 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6260 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6261 if (get_jenv_res == JNI_EDETACHED) {
6262 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6264 DO_ASSERT(get_jenv_res == JNI_OK);
6266 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6268 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
6269 if ((*env)->ExceptionCheck(env)) {
6270 (*env)->ExceptionDescribe(env);
6271 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
6273 LDKCVec_MessageSendEventZ ret_constr;
6274 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6275 if (ret_constr.datalen > 0)
6276 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6278 ret_constr.data = NULL;
6279 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6280 for (size_t s = 0; s < ret_constr.datalen; s++) {
6281 int64_t ret_conv_18 = ret_vals[s];
6282 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
6283 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
6284 ret_constr.data[s] = ret_conv_18_conv;
6286 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6287 if (get_jenv_res == JNI_EDETACHED) {
6288 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6292 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6293 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6294 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6296 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6297 jclass c = (*env)->GetObjectClass(env, o);
6299 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6300 atomic_init(&calls->refcnt, 1);
6301 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6302 calls->o = (*env)->NewWeakGlobalRef(env, o);
6303 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6304 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6306 LDKMessageSendEventsProvider ret = {
6307 .this_arg = (void*) calls,
6308 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6309 .free = LDKMessageSendEventsProvider_JCalls_free,
6313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6314 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6315 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6316 return (uint64_t)res_ptr;
6318 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6319 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6320 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6321 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6322 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6323 for (size_t s = 0; s < ret_var.datalen; s++) {
6324 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6325 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6326 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6327 ret_arr_ptr[s] = ret_conv_18_ref;
6329 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6334 typedef struct LDKEventHandler_JCalls {
6335 atomic_size_t refcnt;
6338 jmethodID handle_event_meth;
6339 } LDKEventHandler_JCalls;
6340 static void LDKEventHandler_JCalls_free(void* this_arg) {
6341 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6342 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6344 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6345 if (get_jenv_res == JNI_EDETACHED) {
6346 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6348 DO_ASSERT(get_jenv_res == JNI_OK);
6350 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6351 if (get_jenv_res == JNI_EDETACHED) {
6352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6357 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6358 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6360 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6361 if (get_jenv_res == JNI_EDETACHED) {
6362 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6364 DO_ASSERT(get_jenv_res == JNI_OK);
6366 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6367 *event_copy = event;
6368 uint64_t event_ref = (uint64_t)event_copy;
6369 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6371 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6372 if ((*env)->ExceptionCheck(env)) {
6373 (*env)->ExceptionDescribe(env);
6374 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
6376 if (get_jenv_res == JNI_EDETACHED) {
6377 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6380 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6381 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6382 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6384 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6385 jclass c = (*env)->GetObjectClass(env, o);
6387 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6388 atomic_init(&calls->refcnt, 1);
6389 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6390 calls->o = (*env)->NewWeakGlobalRef(env, o);
6391 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6392 CHECK(calls->handle_event_meth != NULL);
6394 LDKEventHandler ret = {
6395 .this_arg = (void*) calls,
6396 .handle_event = handle_event_LDKEventHandler_jcall,
6397 .free = LDKEventHandler_JCalls_free,
6401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6402 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6403 *res_ptr = LDKEventHandler_init(env, clz, o);
6404 return (uint64_t)res_ptr;
6406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6407 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6408 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6409 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6412 typedef struct LDKEventsProvider_JCalls {
6413 atomic_size_t refcnt;
6416 jmethodID process_pending_events_meth;
6417 } LDKEventsProvider_JCalls;
6418 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6419 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6420 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6422 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6423 if (get_jenv_res == JNI_EDETACHED) {
6424 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6426 DO_ASSERT(get_jenv_res == JNI_OK);
6428 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6429 if (get_jenv_res == JNI_EDETACHED) {
6430 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6435 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6436 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6438 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6439 if (get_jenv_res == JNI_EDETACHED) {
6440 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6442 DO_ASSERT(get_jenv_res == JNI_OK);
6444 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6446 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6448 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6449 if ((*env)->ExceptionCheck(env)) {
6450 (*env)->ExceptionDescribe(env);
6451 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
6453 if (get_jenv_res == JNI_EDETACHED) {
6454 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6457 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6458 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6461 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6462 jclass c = (*env)->GetObjectClass(env, o);
6464 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6465 atomic_init(&calls->refcnt, 1);
6466 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6467 calls->o = (*env)->NewWeakGlobalRef(env, o);
6468 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6469 CHECK(calls->process_pending_events_meth != NULL);
6471 LDKEventsProvider ret = {
6472 .this_arg = (void*) calls,
6473 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6474 .free = LDKEventsProvider_JCalls_free,
6478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6479 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6480 *res_ptr = LDKEventsProvider_init(env, clz, o);
6481 return (uint64_t)res_ptr;
6483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6484 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6485 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6486 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6487 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6488 LDKEventHandler_JCalls_cloned(&handler_conv);
6490 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6493 typedef struct LDKAccess_JCalls {
6494 atomic_size_t refcnt;
6497 jmethodID get_utxo_meth;
6499 static void LDKAccess_JCalls_free(void* this_arg) {
6500 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6501 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6503 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6504 if (get_jenv_res == JNI_EDETACHED) {
6505 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6507 DO_ASSERT(get_jenv_res == JNI_OK);
6509 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6510 if (get_jenv_res == JNI_EDETACHED) {
6511 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6516 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6517 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6519 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6520 if (get_jenv_res == JNI_EDETACHED) {
6521 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6523 DO_ASSERT(get_jenv_res == JNI_OK);
6525 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6526 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6527 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6529 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6530 if ((*env)->ExceptionCheck(env)) {
6531 (*env)->ExceptionDescribe(env);
6532 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6534 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6535 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6536 if (get_jenv_res == JNI_EDETACHED) {
6537 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6541 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6542 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6543 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6545 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6546 jclass c = (*env)->GetObjectClass(env, o);
6548 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6549 atomic_init(&calls->refcnt, 1);
6550 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6551 calls->o = (*env)->NewWeakGlobalRef(env, o);
6552 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6553 CHECK(calls->get_utxo_meth != NULL);
6556 .this_arg = (void*) calls,
6557 .get_utxo = get_utxo_LDKAccess_jcall,
6558 .free = LDKAccess_JCalls_free,
6562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6563 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6564 *res_ptr = LDKAccess_init(env, clz, o);
6565 return (uint64_t)res_ptr;
6567 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) {
6568 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6569 unsigned char genesis_hash_arr[32];
6570 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6571 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6572 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6573 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6574 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6575 return (uint64_t)ret_conv;
6578 typedef struct LDKListen_JCalls {
6579 atomic_size_t refcnt;
6582 jmethodID block_connected_meth;
6583 jmethodID block_disconnected_meth;
6585 static void LDKListen_JCalls_free(void* this_arg) {
6586 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6587 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6590 if (get_jenv_res == JNI_EDETACHED) {
6591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6593 DO_ASSERT(get_jenv_res == JNI_OK);
6595 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6596 if (get_jenv_res == JNI_EDETACHED) {
6597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6602 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6603 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6605 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6606 if (get_jenv_res == JNI_EDETACHED) {
6607 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6609 DO_ASSERT(get_jenv_res == JNI_OK);
6611 LDKu8slice block_var = block;
6612 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6613 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6614 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6616 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6617 if ((*env)->ExceptionCheck(env)) {
6618 (*env)->ExceptionDescribe(env);
6619 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
6621 if (get_jenv_res == JNI_EDETACHED) {
6622 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6625 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6626 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6628 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6629 if (get_jenv_res == JNI_EDETACHED) {
6630 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6632 DO_ASSERT(get_jenv_res == JNI_OK);
6634 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6635 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6636 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6638 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6639 if ((*env)->ExceptionCheck(env)) {
6640 (*env)->ExceptionDescribe(env);
6641 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
6643 if (get_jenv_res == JNI_EDETACHED) {
6644 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6647 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6648 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6649 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6651 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6652 jclass c = (*env)->GetObjectClass(env, o);
6654 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6655 atomic_init(&calls->refcnt, 1);
6656 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6657 calls->o = (*env)->NewWeakGlobalRef(env, o);
6658 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6659 CHECK(calls->block_connected_meth != NULL);
6660 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6661 CHECK(calls->block_disconnected_meth != NULL);
6664 .this_arg = (void*) calls,
6665 .block_connected = block_connected_LDKListen_jcall,
6666 .block_disconnected = block_disconnected_LDKListen_jcall,
6667 .free = LDKListen_JCalls_free,
6671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6672 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6673 *res_ptr = LDKListen_init(env, clz, o);
6674 return (uint64_t)res_ptr;
6676 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) {
6677 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6678 LDKu8slice block_ref;
6679 block_ref.datalen = (*env)->GetArrayLength(env, block);
6680 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6681 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6682 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6685 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) {
6686 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6687 unsigned char header_arr[80];
6688 CHECK((*env)->GetArrayLength(env, header) == 80);
6689 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6690 unsigned char (*header_ref)[80] = &header_arr;
6691 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6694 typedef struct LDKConfirm_JCalls {
6695 atomic_size_t refcnt;
6698 jmethodID transactions_confirmed_meth;
6699 jmethodID transaction_unconfirmed_meth;
6700 jmethodID best_block_updated_meth;
6701 jmethodID get_relevant_txids_meth;
6702 } LDKConfirm_JCalls;
6703 static void LDKConfirm_JCalls_free(void* this_arg) {
6704 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6705 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6707 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6708 if (get_jenv_res == JNI_EDETACHED) {
6709 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6711 DO_ASSERT(get_jenv_res == JNI_OK);
6713 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6714 if (get_jenv_res == JNI_EDETACHED) {
6715 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6720 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6721 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6723 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6724 if (get_jenv_res == JNI_EDETACHED) {
6725 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6727 DO_ASSERT(get_jenv_res == JNI_OK);
6729 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6730 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6731 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6732 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6733 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6734 for (size_t y = 0; y < txdata_var.datalen; y++) {
6735 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6736 *txdata_conv_24_ref = txdata_var.data[y];
6737 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6739 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6740 FREE(txdata_var.data);
6741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6743 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6744 if ((*env)->ExceptionCheck(env)) {
6745 (*env)->ExceptionDescribe(env);
6746 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
6748 if (get_jenv_res == JNI_EDETACHED) {
6749 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6752 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6753 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6755 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6756 if (get_jenv_res == JNI_EDETACHED) {
6757 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6759 DO_ASSERT(get_jenv_res == JNI_OK);
6761 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6762 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6763 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6765 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6766 if ((*env)->ExceptionCheck(env)) {
6767 (*env)->ExceptionDescribe(env);
6768 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
6770 if (get_jenv_res == JNI_EDETACHED) {
6771 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6774 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6775 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6777 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6778 if (get_jenv_res == JNI_EDETACHED) {
6779 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6781 DO_ASSERT(get_jenv_res == JNI_OK);
6783 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6784 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6785 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6787 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6788 if ((*env)->ExceptionCheck(env)) {
6789 (*env)->ExceptionDescribe(env);
6790 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
6792 if (get_jenv_res == JNI_EDETACHED) {
6793 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6796 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6797 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6799 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6800 if (get_jenv_res == JNI_EDETACHED) {
6801 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6803 DO_ASSERT(get_jenv_res == JNI_OK);
6805 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6807 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6808 if ((*env)->ExceptionCheck(env)) {
6809 (*env)->ExceptionDescribe(env);
6810 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
6812 LDKCVec_TxidZ ret_constr;
6813 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6814 if (ret_constr.datalen > 0)
6815 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6817 ret_constr.data = NULL;
6818 for (size_t i = 0; i < ret_constr.datalen; i++) {
6819 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6820 LDKThirtyTwoBytes ret_conv_8_ref;
6821 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6822 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6823 ret_constr.data[i] = ret_conv_8_ref;
6825 if (get_jenv_res == JNI_EDETACHED) {
6826 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6830 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6831 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6832 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6834 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6835 jclass c = (*env)->GetObjectClass(env, o);
6837 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6838 atomic_init(&calls->refcnt, 1);
6839 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6840 calls->o = (*env)->NewWeakGlobalRef(env, o);
6841 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6842 CHECK(calls->transactions_confirmed_meth != NULL);
6843 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6844 CHECK(calls->transaction_unconfirmed_meth != NULL);
6845 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6846 CHECK(calls->best_block_updated_meth != NULL);
6847 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6848 CHECK(calls->get_relevant_txids_meth != NULL);
6851 .this_arg = (void*) calls,
6852 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6853 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6854 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6855 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6856 .free = LDKConfirm_JCalls_free,
6860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6861 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6862 *res_ptr = LDKConfirm_init(env, clz, o);
6863 return (uint64_t)res_ptr;
6865 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) {
6866 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6867 unsigned char header_arr[80];
6868 CHECK((*env)->GetArrayLength(env, header) == 80);
6869 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6870 unsigned char (*header_ref)[80] = &header_arr;
6871 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6872 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6873 if (txdata_constr.datalen > 0)
6874 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6876 txdata_constr.data = NULL;
6877 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6878 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6879 int64_t txdata_conv_24 = txdata_vals[y];
6880 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6881 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6882 txdata_constr.data[y] = txdata_conv_24_conv;
6884 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6885 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6889 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6890 unsigned char txid_arr[32];
6891 CHECK((*env)->GetArrayLength(env, txid) == 32);
6892 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6893 unsigned char (*txid_ref)[32] = &txid_arr;
6894 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6897 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) {
6898 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6899 unsigned char header_arr[80];
6900 CHECK((*env)->GetArrayLength(env, header) == 80);
6901 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6902 unsigned char (*header_ref)[80] = &header_arr;
6903 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6906 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6907 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6908 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6909 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6911 for (size_t i = 0; i < ret_var.datalen; i++) {
6912 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6913 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6914 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6920 typedef struct LDKFilter_JCalls {
6921 atomic_size_t refcnt;
6924 jmethodID register_tx_meth;
6925 jmethodID register_output_meth;
6927 static void LDKFilter_JCalls_free(void* this_arg) {
6928 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6929 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6931 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6932 if (get_jenv_res == JNI_EDETACHED) {
6933 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6935 DO_ASSERT(get_jenv_res == JNI_OK);
6937 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6938 if (get_jenv_res == JNI_EDETACHED) {
6939 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6944 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6945 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6948 if (get_jenv_res == JNI_EDETACHED) {
6949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6951 DO_ASSERT(get_jenv_res == JNI_OK);
6953 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6954 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6955 LDKu8slice script_pubkey_var = script_pubkey;
6956 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6957 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6958 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6960 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6961 if ((*env)->ExceptionCheck(env)) {
6962 (*env)->ExceptionDescribe(env);
6963 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
6965 if (get_jenv_res == JNI_EDETACHED) {
6966 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6969 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6970 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6972 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6973 if (get_jenv_res == JNI_EDETACHED) {
6974 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6976 DO_ASSERT(get_jenv_res == JNI_OK);
6978 LDKWatchedOutput output_var = output;
6979 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6980 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6981 uint64_t output_ref = (uint64_t)output_var.inner;
6982 if (output_var.is_owned) {
6985 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6987 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6988 if ((*env)->ExceptionCheck(env)) {
6989 (*env)->ExceptionDescribe(env);
6990 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
6992 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6993 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6994 if (get_jenv_res == JNI_EDETACHED) {
6995 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6999 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7000 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7001 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7003 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7004 jclass c = (*env)->GetObjectClass(env, o);
7006 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7007 atomic_init(&calls->refcnt, 1);
7008 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7009 calls->o = (*env)->NewWeakGlobalRef(env, o);
7010 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7011 CHECK(calls->register_tx_meth != NULL);
7012 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7013 CHECK(calls->register_output_meth != NULL);
7016 .this_arg = (void*) calls,
7017 .register_tx = register_tx_LDKFilter_jcall,
7018 .register_output = register_output_LDKFilter_jcall,
7019 .free = LDKFilter_JCalls_free,
7023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7024 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7025 *res_ptr = LDKFilter_init(env, clz, o);
7026 return (uint64_t)res_ptr;
7028 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) {
7029 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7030 unsigned char txid_arr[32];
7031 CHECK((*env)->GetArrayLength(env, txid) == 32);
7032 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7033 unsigned char (*txid_ref)[32] = &txid_arr;
7034 LDKu8slice script_pubkey_ref;
7035 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7036 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7037 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7038 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7042 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7043 LDKWatchedOutput output_conv;
7044 output_conv.inner = (void*)(output & (~1));
7045 output_conv.is_owned = (output & 1) || (output == 0);
7046 output_conv = WatchedOutput_clone(&output_conv);
7047 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7048 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7049 uint64_t ret_ref = (uint64_t)ret_copy;
7053 typedef struct LDKPersist_JCalls {
7054 atomic_size_t refcnt;
7057 jmethodID persist_new_channel_meth;
7058 jmethodID update_persisted_channel_meth;
7059 } LDKPersist_JCalls;
7060 static void LDKPersist_JCalls_free(void* this_arg) {
7061 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7062 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7064 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7065 if (get_jenv_res == JNI_EDETACHED) {
7066 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7068 DO_ASSERT(get_jenv_res == JNI_OK);
7070 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7071 if (get_jenv_res == JNI_EDETACHED) {
7072 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7077 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7078 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7080 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7081 if (get_jenv_res == JNI_EDETACHED) {
7082 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7084 DO_ASSERT(get_jenv_res == JNI_OK);
7086 LDKOutPoint id_var = id;
7087 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7088 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7089 uint64_t id_ref = (uint64_t)id_var.inner;
7090 if (id_var.is_owned) {
7093 LDKChannelMonitor data_var = *data;
7094 data_var = ChannelMonitor_clone(data);
7095 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7096 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7097 uint64_t data_ref = (uint64_t)data_var.inner;
7098 if (data_var.is_owned) {
7101 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7103 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7104 if ((*env)->ExceptionCheck(env)) {
7105 (*env)->ExceptionDescribe(env);
7106 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7108 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7109 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7110 if (get_jenv_res == JNI_EDETACHED) {
7111 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7115 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7116 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7118 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7119 if (get_jenv_res == JNI_EDETACHED) {
7120 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7122 DO_ASSERT(get_jenv_res == JNI_OK);
7124 LDKOutPoint id_var = id;
7125 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7126 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7127 uint64_t id_ref = (uint64_t)id_var.inner;
7128 if (id_var.is_owned) {
7131 LDKChannelMonitorUpdate update_var = *update;
7132 update_var = ChannelMonitorUpdate_clone(update);
7133 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7134 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7135 uint64_t update_ref = (uint64_t)update_var.inner;
7136 if (update_var.is_owned) {
7139 LDKChannelMonitor data_var = *data;
7140 data_var = ChannelMonitor_clone(data);
7141 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7142 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7143 uint64_t data_ref = (uint64_t)data_var.inner;
7144 if (data_var.is_owned) {
7147 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7149 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7150 if ((*env)->ExceptionCheck(env)) {
7151 (*env)->ExceptionDescribe(env);
7152 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7154 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7155 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7156 if (get_jenv_res == JNI_EDETACHED) {
7157 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7161 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7162 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7163 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7165 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7166 jclass c = (*env)->GetObjectClass(env, o);
7168 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7169 atomic_init(&calls->refcnt, 1);
7170 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7171 calls->o = (*env)->NewWeakGlobalRef(env, o);
7172 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7173 CHECK(calls->persist_new_channel_meth != NULL);
7174 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7175 CHECK(calls->update_persisted_channel_meth != NULL);
7178 .this_arg = (void*) calls,
7179 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7180 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7181 .free = LDKPersist_JCalls_free,
7185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7186 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7187 *res_ptr = LDKPersist_init(env, clz, o);
7188 return (uint64_t)res_ptr;
7190 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) {
7191 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7192 LDKOutPoint id_conv;
7193 id_conv.inner = (void*)(id & (~1));
7194 id_conv.is_owned = (id & 1) || (id == 0);
7195 id_conv = OutPoint_clone(&id_conv);
7196 LDKChannelMonitor data_conv;
7197 data_conv.inner = (void*)(data & (~1));
7198 data_conv.is_owned = false;
7199 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7200 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7201 return (uint64_t)ret_conv;
7204 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) {
7205 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7206 LDKOutPoint id_conv;
7207 id_conv.inner = (void*)(id & (~1));
7208 id_conv.is_owned = (id & 1) || (id == 0);
7209 id_conv = OutPoint_clone(&id_conv);
7210 LDKChannelMonitorUpdate update_conv;
7211 update_conv.inner = (void*)(update & (~1));
7212 update_conv.is_owned = false;
7213 LDKChannelMonitor data_conv;
7214 data_conv.inner = (void*)(data & (~1));
7215 data_conv.is_owned = false;
7216 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7217 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7218 return (uint64_t)ret_conv;
7221 typedef struct LDKChannelMessageHandler_JCalls {
7222 atomic_size_t refcnt;
7225 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7226 jmethodID handle_open_channel_meth;
7227 jmethodID handle_accept_channel_meth;
7228 jmethodID handle_funding_created_meth;
7229 jmethodID handle_funding_signed_meth;
7230 jmethodID handle_funding_locked_meth;
7231 jmethodID handle_shutdown_meth;
7232 jmethodID handle_closing_signed_meth;
7233 jmethodID handle_update_add_htlc_meth;
7234 jmethodID handle_update_fulfill_htlc_meth;
7235 jmethodID handle_update_fail_htlc_meth;
7236 jmethodID handle_update_fail_malformed_htlc_meth;
7237 jmethodID handle_commitment_signed_meth;
7238 jmethodID handle_revoke_and_ack_meth;
7239 jmethodID handle_update_fee_meth;
7240 jmethodID handle_announcement_signatures_meth;
7241 jmethodID peer_disconnected_meth;
7242 jmethodID peer_connected_meth;
7243 jmethodID handle_channel_reestablish_meth;
7244 jmethodID handle_channel_update_meth;
7245 jmethodID handle_error_meth;
7246 } LDKChannelMessageHandler_JCalls;
7247 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7249 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7251 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7252 if (get_jenv_res == JNI_EDETACHED) {
7253 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7255 DO_ASSERT(get_jenv_res == JNI_OK);
7257 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7258 if (get_jenv_res == JNI_EDETACHED) {
7259 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7264 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7265 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7267 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7268 if (get_jenv_res == JNI_EDETACHED) {
7269 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7271 DO_ASSERT(get_jenv_res == JNI_OK);
7273 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7274 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7275 LDKInitFeatures their_features_var = their_features;
7276 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7277 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7278 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7279 if (their_features_var.is_owned) {
7280 their_features_ref |= 1;
7282 LDKOpenChannel msg_var = *msg;
7283 msg_var = OpenChannel_clone(msg);
7284 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7285 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7286 uint64_t msg_ref = (uint64_t)msg_var.inner;
7287 if (msg_var.is_owned) {
7290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7292 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7293 if ((*env)->ExceptionCheck(env)) {
7294 (*env)->ExceptionDescribe(env);
7295 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
7297 if (get_jenv_res == JNI_EDETACHED) {
7298 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7301 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7302 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7304 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7305 if (get_jenv_res == JNI_EDETACHED) {
7306 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7308 DO_ASSERT(get_jenv_res == JNI_OK);
7310 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7311 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7312 LDKInitFeatures their_features_var = their_features;
7313 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7314 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7315 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7316 if (their_features_var.is_owned) {
7317 their_features_ref |= 1;
7319 LDKAcceptChannel msg_var = *msg;
7320 msg_var = AcceptChannel_clone(msg);
7321 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7322 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7323 uint64_t msg_ref = (uint64_t)msg_var.inner;
7324 if (msg_var.is_owned) {
7327 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7329 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7330 if ((*env)->ExceptionCheck(env)) {
7331 (*env)->ExceptionDescribe(env);
7332 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
7334 if (get_jenv_res == JNI_EDETACHED) {
7335 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7338 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7339 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7341 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7342 if (get_jenv_res == JNI_EDETACHED) {
7343 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7345 DO_ASSERT(get_jenv_res == JNI_OK);
7347 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7348 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7349 LDKFundingCreated msg_var = *msg;
7350 msg_var = FundingCreated_clone(msg);
7351 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7352 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7353 uint64_t msg_ref = (uint64_t)msg_var.inner;
7354 if (msg_var.is_owned) {
7357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7359 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7360 if ((*env)->ExceptionCheck(env)) {
7361 (*env)->ExceptionDescribe(env);
7362 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
7364 if (get_jenv_res == JNI_EDETACHED) {
7365 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7368 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7369 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7371 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7372 if (get_jenv_res == JNI_EDETACHED) {
7373 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7375 DO_ASSERT(get_jenv_res == JNI_OK);
7377 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7378 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7379 LDKFundingSigned msg_var = *msg;
7380 msg_var = FundingSigned_clone(msg);
7381 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7382 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7383 uint64_t msg_ref = (uint64_t)msg_var.inner;
7384 if (msg_var.is_owned) {
7387 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7389 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7390 if ((*env)->ExceptionCheck(env)) {
7391 (*env)->ExceptionDescribe(env);
7392 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
7394 if (get_jenv_res == JNI_EDETACHED) {
7395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7398 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7399 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7402 if (get_jenv_res == JNI_EDETACHED) {
7403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7405 DO_ASSERT(get_jenv_res == JNI_OK);
7407 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7408 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7409 LDKFundingLocked msg_var = *msg;
7410 msg_var = FundingLocked_clone(msg);
7411 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7412 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7413 uint64_t msg_ref = (uint64_t)msg_var.inner;
7414 if (msg_var.is_owned) {
7417 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7419 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7420 if ((*env)->ExceptionCheck(env)) {
7421 (*env)->ExceptionDescribe(env);
7422 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
7424 if (get_jenv_res == JNI_EDETACHED) {
7425 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7428 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7429 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7431 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7432 if (get_jenv_res == JNI_EDETACHED) {
7433 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7435 DO_ASSERT(get_jenv_res == JNI_OK);
7437 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7438 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7439 LDKInitFeatures their_features_var = *their_features;
7440 their_features_var = InitFeatures_clone(their_features);
7441 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7442 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7443 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7444 if (their_features_var.is_owned) {
7445 their_features_ref |= 1;
7447 LDKShutdown msg_var = *msg;
7448 msg_var = Shutdown_clone(msg);
7449 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7450 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7451 uint64_t msg_ref = (uint64_t)msg_var.inner;
7452 if (msg_var.is_owned) {
7455 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7457 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7458 if ((*env)->ExceptionCheck(env)) {
7459 (*env)->ExceptionDescribe(env);
7460 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
7462 if (get_jenv_res == JNI_EDETACHED) {
7463 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7466 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7467 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7469 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7470 if (get_jenv_res == JNI_EDETACHED) {
7471 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7473 DO_ASSERT(get_jenv_res == JNI_OK);
7475 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7476 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7477 LDKClosingSigned msg_var = *msg;
7478 msg_var = ClosingSigned_clone(msg);
7479 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7480 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7481 uint64_t msg_ref = (uint64_t)msg_var.inner;
7482 if (msg_var.is_owned) {
7485 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7487 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7488 if ((*env)->ExceptionCheck(env)) {
7489 (*env)->ExceptionDescribe(env);
7490 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
7492 if (get_jenv_res == JNI_EDETACHED) {
7493 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7496 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7497 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7499 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7500 if (get_jenv_res == JNI_EDETACHED) {
7501 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7503 DO_ASSERT(get_jenv_res == JNI_OK);
7505 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7506 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7507 LDKUpdateAddHTLC msg_var = *msg;
7508 msg_var = UpdateAddHTLC_clone(msg);
7509 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7510 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7511 uint64_t msg_ref = (uint64_t)msg_var.inner;
7512 if (msg_var.is_owned) {
7515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7517 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7518 if ((*env)->ExceptionCheck(env)) {
7519 (*env)->ExceptionDescribe(env);
7520 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
7522 if (get_jenv_res == JNI_EDETACHED) {
7523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7526 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7527 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7529 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7530 if (get_jenv_res == JNI_EDETACHED) {
7531 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7533 DO_ASSERT(get_jenv_res == JNI_OK);
7535 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7536 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7537 LDKUpdateFulfillHTLC msg_var = *msg;
7538 msg_var = UpdateFulfillHTLC_clone(msg);
7539 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7540 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7541 uint64_t msg_ref = (uint64_t)msg_var.inner;
7542 if (msg_var.is_owned) {
7545 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7547 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7548 if ((*env)->ExceptionCheck(env)) {
7549 (*env)->ExceptionDescribe(env);
7550 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
7552 if (get_jenv_res == JNI_EDETACHED) {
7553 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7556 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7557 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7559 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7560 if (get_jenv_res == JNI_EDETACHED) {
7561 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7563 DO_ASSERT(get_jenv_res == JNI_OK);
7565 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7566 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7567 LDKUpdateFailHTLC msg_var = *msg;
7568 msg_var = UpdateFailHTLC_clone(msg);
7569 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7570 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7571 uint64_t msg_ref = (uint64_t)msg_var.inner;
7572 if (msg_var.is_owned) {
7575 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7577 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7578 if ((*env)->ExceptionCheck(env)) {
7579 (*env)->ExceptionDescribe(env);
7580 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
7582 if (get_jenv_res == JNI_EDETACHED) {
7583 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7586 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7587 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7590 if (get_jenv_res == JNI_EDETACHED) {
7591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7593 DO_ASSERT(get_jenv_res == JNI_OK);
7595 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7596 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7597 LDKUpdateFailMalformedHTLC msg_var = *msg;
7598 msg_var = UpdateFailMalformedHTLC_clone(msg);
7599 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7600 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7601 uint64_t msg_ref = (uint64_t)msg_var.inner;
7602 if (msg_var.is_owned) {
7605 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7607 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7608 if ((*env)->ExceptionCheck(env)) {
7609 (*env)->ExceptionDescribe(env);
7610 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
7612 if (get_jenv_res == JNI_EDETACHED) {
7613 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7616 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7617 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7619 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7620 if (get_jenv_res == JNI_EDETACHED) {
7621 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7623 DO_ASSERT(get_jenv_res == JNI_OK);
7625 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7626 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7627 LDKCommitmentSigned msg_var = *msg;
7628 msg_var = CommitmentSigned_clone(msg);
7629 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7630 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7631 uint64_t msg_ref = (uint64_t)msg_var.inner;
7632 if (msg_var.is_owned) {
7635 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7637 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7638 if ((*env)->ExceptionCheck(env)) {
7639 (*env)->ExceptionDescribe(env);
7640 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
7642 if (get_jenv_res == JNI_EDETACHED) {
7643 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7646 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7647 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7649 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7650 if (get_jenv_res == JNI_EDETACHED) {
7651 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7653 DO_ASSERT(get_jenv_res == JNI_OK);
7655 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7656 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7657 LDKRevokeAndACK msg_var = *msg;
7658 msg_var = RevokeAndACK_clone(msg);
7659 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7660 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7661 uint64_t msg_ref = (uint64_t)msg_var.inner;
7662 if (msg_var.is_owned) {
7665 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7667 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7668 if ((*env)->ExceptionCheck(env)) {
7669 (*env)->ExceptionDescribe(env);
7670 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
7672 if (get_jenv_res == JNI_EDETACHED) {
7673 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7676 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7677 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7679 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7680 if (get_jenv_res == JNI_EDETACHED) {
7681 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7683 DO_ASSERT(get_jenv_res == JNI_OK);
7685 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7686 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7687 LDKUpdateFee msg_var = *msg;
7688 msg_var = UpdateFee_clone(msg);
7689 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7690 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7691 uint64_t msg_ref = (uint64_t)msg_var.inner;
7692 if (msg_var.is_owned) {
7695 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7697 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7698 if ((*env)->ExceptionCheck(env)) {
7699 (*env)->ExceptionDescribe(env);
7700 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
7702 if (get_jenv_res == JNI_EDETACHED) {
7703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7706 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7707 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7709 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7710 if (get_jenv_res == JNI_EDETACHED) {
7711 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7713 DO_ASSERT(get_jenv_res == JNI_OK);
7715 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7716 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7717 LDKAnnouncementSignatures msg_var = *msg;
7718 msg_var = AnnouncementSignatures_clone(msg);
7719 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7720 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7721 uint64_t msg_ref = (uint64_t)msg_var.inner;
7722 if (msg_var.is_owned) {
7725 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7727 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7728 if ((*env)->ExceptionCheck(env)) {
7729 (*env)->ExceptionDescribe(env);
7730 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
7732 if (get_jenv_res == JNI_EDETACHED) {
7733 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7736 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7737 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7739 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7740 if (get_jenv_res == JNI_EDETACHED) {
7741 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7743 DO_ASSERT(get_jenv_res == JNI_OK);
7745 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7746 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7747 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7749 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7750 if ((*env)->ExceptionCheck(env)) {
7751 (*env)->ExceptionDescribe(env);
7752 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
7754 if (get_jenv_res == JNI_EDETACHED) {
7755 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7758 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7759 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7762 if (get_jenv_res == JNI_EDETACHED) {
7763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7765 DO_ASSERT(get_jenv_res == JNI_OK);
7767 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7768 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7769 LDKInit msg_var = *msg;
7770 msg_var = Init_clone(msg);
7771 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7772 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7773 uint64_t msg_ref = (uint64_t)msg_var.inner;
7774 if (msg_var.is_owned) {
7777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7779 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7780 if ((*env)->ExceptionCheck(env)) {
7781 (*env)->ExceptionDescribe(env);
7782 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
7784 if (get_jenv_res == JNI_EDETACHED) {
7785 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7788 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7789 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7791 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7792 if (get_jenv_res == JNI_EDETACHED) {
7793 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7795 DO_ASSERT(get_jenv_res == JNI_OK);
7797 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7798 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7799 LDKChannelReestablish msg_var = *msg;
7800 msg_var = ChannelReestablish_clone(msg);
7801 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7802 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7803 uint64_t msg_ref = (uint64_t)msg_var.inner;
7804 if (msg_var.is_owned) {
7807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7809 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7810 if ((*env)->ExceptionCheck(env)) {
7811 (*env)->ExceptionDescribe(env);
7812 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
7814 if (get_jenv_res == JNI_EDETACHED) {
7815 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7818 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7819 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7822 if (get_jenv_res == JNI_EDETACHED) {
7823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7825 DO_ASSERT(get_jenv_res == JNI_OK);
7827 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7828 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7829 LDKChannelUpdate msg_var = *msg;
7830 msg_var = ChannelUpdate_clone(msg);
7831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7833 uint64_t msg_ref = (uint64_t)msg_var.inner;
7834 if (msg_var.is_owned) {
7837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7839 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7840 if ((*env)->ExceptionCheck(env)) {
7841 (*env)->ExceptionDescribe(env);
7842 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
7844 if (get_jenv_res == JNI_EDETACHED) {
7845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7848 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7849 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7851 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7852 if (get_jenv_res == JNI_EDETACHED) {
7853 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7855 DO_ASSERT(get_jenv_res == JNI_OK);
7857 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7858 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7859 LDKErrorMessage msg_var = *msg;
7860 msg_var = ErrorMessage_clone(msg);
7861 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7862 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7863 uint64_t msg_ref = (uint64_t)msg_var.inner;
7864 if (msg_var.is_owned) {
7867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7869 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7870 if ((*env)->ExceptionCheck(env)) {
7871 (*env)->ExceptionDescribe(env);
7872 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
7874 if (get_jenv_res == JNI_EDETACHED) {
7875 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7878 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7879 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7880 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7881 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7883 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7884 jclass c = (*env)->GetObjectClass(env, o);
7886 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7887 atomic_init(&calls->refcnt, 1);
7888 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7889 calls->o = (*env)->NewWeakGlobalRef(env, o);
7890 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7891 CHECK(calls->handle_open_channel_meth != NULL);
7892 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7893 CHECK(calls->handle_accept_channel_meth != NULL);
7894 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7895 CHECK(calls->handle_funding_created_meth != NULL);
7896 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7897 CHECK(calls->handle_funding_signed_meth != NULL);
7898 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7899 CHECK(calls->handle_funding_locked_meth != NULL);
7900 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7901 CHECK(calls->handle_shutdown_meth != NULL);
7902 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7903 CHECK(calls->handle_closing_signed_meth != NULL);
7904 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7905 CHECK(calls->handle_update_add_htlc_meth != NULL);
7906 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7907 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7908 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7909 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7910 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7911 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7912 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7913 CHECK(calls->handle_commitment_signed_meth != NULL);
7914 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7915 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7916 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7917 CHECK(calls->handle_update_fee_meth != NULL);
7918 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7919 CHECK(calls->handle_announcement_signatures_meth != NULL);
7920 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7921 CHECK(calls->peer_disconnected_meth != NULL);
7922 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7923 CHECK(calls->peer_connected_meth != NULL);
7924 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7925 CHECK(calls->handle_channel_reestablish_meth != NULL);
7926 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7927 CHECK(calls->handle_channel_update_meth != NULL);
7928 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7929 CHECK(calls->handle_error_meth != NULL);
7931 LDKChannelMessageHandler ret = {
7932 .this_arg = (void*) calls,
7933 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7934 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7935 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7936 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7937 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7938 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7939 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7940 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7941 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7942 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7943 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7944 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7945 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7946 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7947 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7948 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7949 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7950 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7951 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7952 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7953 .free = LDKChannelMessageHandler_JCalls_free,
7954 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7956 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7960 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7961 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7962 return (uint64_t)res_ptr;
7964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
7965 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
7966 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
7967 DO_ASSERT((res_ptr & 1) == 0);
7968 return (int64_t)(res_ptr | 1);
7970 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) {
7971 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7972 LDKPublicKey their_node_id_ref;
7973 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7974 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7975 LDKInitFeatures their_features_conv;
7976 their_features_conv.inner = (void*)(their_features & (~1));
7977 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7978 their_features_conv = InitFeatures_clone(&their_features_conv);
7979 LDKOpenChannel msg_conv;
7980 msg_conv.inner = (void*)(msg & (~1));
7981 msg_conv.is_owned = false;
7982 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7985 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) {
7986 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7987 LDKPublicKey their_node_id_ref;
7988 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7989 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7990 LDKInitFeatures their_features_conv;
7991 their_features_conv.inner = (void*)(their_features & (~1));
7992 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7993 their_features_conv = InitFeatures_clone(&their_features_conv);
7994 LDKAcceptChannel msg_conv;
7995 msg_conv.inner = (void*)(msg & (~1));
7996 msg_conv.is_owned = false;
7997 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8000 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) {
8001 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8002 LDKPublicKey their_node_id_ref;
8003 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8004 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8005 LDKFundingCreated msg_conv;
8006 msg_conv.inner = (void*)(msg & (~1));
8007 msg_conv.is_owned = false;
8008 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8011 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) {
8012 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8013 LDKPublicKey their_node_id_ref;
8014 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8015 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8016 LDKFundingSigned msg_conv;
8017 msg_conv.inner = (void*)(msg & (~1));
8018 msg_conv.is_owned = false;
8019 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8022 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) {
8023 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8024 LDKPublicKey their_node_id_ref;
8025 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8026 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8027 LDKFundingLocked msg_conv;
8028 msg_conv.inner = (void*)(msg & (~1));
8029 msg_conv.is_owned = false;
8030 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8033 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) {
8034 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8035 LDKPublicKey their_node_id_ref;
8036 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8037 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8038 LDKInitFeatures their_features_conv;
8039 their_features_conv.inner = (void*)(their_features & (~1));
8040 their_features_conv.is_owned = false;
8041 LDKShutdown msg_conv;
8042 msg_conv.inner = (void*)(msg & (~1));
8043 msg_conv.is_owned = false;
8044 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8047 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) {
8048 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8049 LDKPublicKey their_node_id_ref;
8050 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8051 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8052 LDKClosingSigned msg_conv;
8053 msg_conv.inner = (void*)(msg & (~1));
8054 msg_conv.is_owned = false;
8055 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8058 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) {
8059 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8060 LDKPublicKey their_node_id_ref;
8061 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8062 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8063 LDKUpdateAddHTLC msg_conv;
8064 msg_conv.inner = (void*)(msg & (~1));
8065 msg_conv.is_owned = false;
8066 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8069 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) {
8070 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8071 LDKPublicKey their_node_id_ref;
8072 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8073 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8074 LDKUpdateFulfillHTLC msg_conv;
8075 msg_conv.inner = (void*)(msg & (~1));
8076 msg_conv.is_owned = false;
8077 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8080 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) {
8081 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8082 LDKPublicKey their_node_id_ref;
8083 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8084 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8085 LDKUpdateFailHTLC msg_conv;
8086 msg_conv.inner = (void*)(msg & (~1));
8087 msg_conv.is_owned = false;
8088 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8091 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) {
8092 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8093 LDKPublicKey their_node_id_ref;
8094 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8095 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8096 LDKUpdateFailMalformedHTLC msg_conv;
8097 msg_conv.inner = (void*)(msg & (~1));
8098 msg_conv.is_owned = false;
8099 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8102 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) {
8103 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8104 LDKPublicKey their_node_id_ref;
8105 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8106 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8107 LDKCommitmentSigned msg_conv;
8108 msg_conv.inner = (void*)(msg & (~1));
8109 msg_conv.is_owned = false;
8110 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8113 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) {
8114 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8115 LDKPublicKey their_node_id_ref;
8116 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8117 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8118 LDKRevokeAndACK msg_conv;
8119 msg_conv.inner = (void*)(msg & (~1));
8120 msg_conv.is_owned = false;
8121 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8124 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) {
8125 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8126 LDKPublicKey their_node_id_ref;
8127 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8128 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8129 LDKUpdateFee msg_conv;
8130 msg_conv.inner = (void*)(msg & (~1));
8131 msg_conv.is_owned = false;
8132 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8135 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) {
8136 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8137 LDKPublicKey their_node_id_ref;
8138 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8139 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8140 LDKAnnouncementSignatures msg_conv;
8141 msg_conv.inner = (void*)(msg & (~1));
8142 msg_conv.is_owned = false;
8143 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8146 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) {
8147 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8148 LDKPublicKey their_node_id_ref;
8149 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8150 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8151 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8154 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) {
8155 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8156 LDKPublicKey their_node_id_ref;
8157 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8158 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8160 msg_conv.inner = (void*)(msg & (~1));
8161 msg_conv.is_owned = false;
8162 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8165 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) {
8166 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8167 LDKPublicKey their_node_id_ref;
8168 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8169 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8170 LDKChannelReestablish msg_conv;
8171 msg_conv.inner = (void*)(msg & (~1));
8172 msg_conv.is_owned = false;
8173 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8176 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) {
8177 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8178 LDKPublicKey their_node_id_ref;
8179 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8180 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8181 LDKChannelUpdate msg_conv;
8182 msg_conv.inner = (void*)(msg & (~1));
8183 msg_conv.is_owned = false;
8184 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8187 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) {
8188 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8189 LDKPublicKey their_node_id_ref;
8190 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8191 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8192 LDKErrorMessage msg_conv;
8193 msg_conv.inner = (void*)(msg & (~1));
8194 msg_conv.is_owned = false;
8195 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8198 typedef struct LDKRoutingMessageHandler_JCalls {
8199 atomic_size_t refcnt;
8202 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8203 jmethodID handle_node_announcement_meth;
8204 jmethodID handle_channel_announcement_meth;
8205 jmethodID handle_channel_update_meth;
8206 jmethodID handle_htlc_fail_channel_update_meth;
8207 jmethodID get_next_channel_announcements_meth;
8208 jmethodID get_next_node_announcements_meth;
8209 jmethodID sync_routing_table_meth;
8210 jmethodID handle_reply_channel_range_meth;
8211 jmethodID handle_reply_short_channel_ids_end_meth;
8212 jmethodID handle_query_channel_range_meth;
8213 jmethodID handle_query_short_channel_ids_meth;
8214 } LDKRoutingMessageHandler_JCalls;
8215 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8216 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8217 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8219 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8220 if (get_jenv_res == JNI_EDETACHED) {
8221 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8223 DO_ASSERT(get_jenv_res == JNI_OK);
8225 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8226 if (get_jenv_res == JNI_EDETACHED) {
8227 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8232 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8233 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8235 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8236 if (get_jenv_res == JNI_EDETACHED) {
8237 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8239 DO_ASSERT(get_jenv_res == JNI_OK);
8241 LDKNodeAnnouncement msg_var = *msg;
8242 msg_var = NodeAnnouncement_clone(msg);
8243 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8244 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8245 uint64_t msg_ref = (uint64_t)msg_var.inner;
8246 if (msg_var.is_owned) {
8249 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8251 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8252 if ((*env)->ExceptionCheck(env)) {
8253 (*env)->ExceptionDescribe(env);
8254 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8256 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8257 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8258 if (get_jenv_res == JNI_EDETACHED) {
8259 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8263 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8264 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8266 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8267 if (get_jenv_res == JNI_EDETACHED) {
8268 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8270 DO_ASSERT(get_jenv_res == JNI_OK);
8272 LDKChannelAnnouncement msg_var = *msg;
8273 msg_var = ChannelAnnouncement_clone(msg);
8274 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8275 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8276 uint64_t msg_ref = (uint64_t)msg_var.inner;
8277 if (msg_var.is_owned) {
8280 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8282 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8283 if ((*env)->ExceptionCheck(env)) {
8284 (*env)->ExceptionDescribe(env);
8285 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8287 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8288 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8289 if (get_jenv_res == JNI_EDETACHED) {
8290 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8294 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8295 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8297 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8298 if (get_jenv_res == JNI_EDETACHED) {
8299 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8301 DO_ASSERT(get_jenv_res == JNI_OK);
8303 LDKChannelUpdate msg_var = *msg;
8304 msg_var = ChannelUpdate_clone(msg);
8305 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8306 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8307 uint64_t msg_ref = (uint64_t)msg_var.inner;
8308 if (msg_var.is_owned) {
8311 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8313 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8314 if ((*env)->ExceptionCheck(env)) {
8315 (*env)->ExceptionDescribe(env);
8316 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8318 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8319 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8320 if (get_jenv_res == JNI_EDETACHED) {
8321 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8325 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
8326 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8328 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8329 if (get_jenv_res == JNI_EDETACHED) {
8330 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8332 DO_ASSERT(get_jenv_res == JNI_OK);
8334 uint64_t ret_update = (uint64_t)update;
8335 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8337 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
8338 if ((*env)->ExceptionCheck(env)) {
8339 (*env)->ExceptionDescribe(env);
8340 (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8342 if (get_jenv_res == JNI_EDETACHED) {
8343 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8346 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8347 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8349 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8350 if (get_jenv_res == JNI_EDETACHED) {
8351 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8353 DO_ASSERT(get_jenv_res == JNI_OK);
8355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8357 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8358 if ((*env)->ExceptionCheck(env)) {
8359 (*env)->ExceptionDescribe(env);
8360 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8362 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8363 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8364 if (ret_constr.datalen > 0)
8365 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8367 ret_constr.data = NULL;
8368 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8369 for (size_t l = 0; l < ret_constr.datalen; l++) {
8370 int64_t ret_conv_63 = ret_vals[l];
8371 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8372 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8373 ret_constr.data[l] = ret_conv_63_conv;
8375 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8376 if (get_jenv_res == JNI_EDETACHED) {
8377 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8381 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8382 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8384 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8385 if (get_jenv_res == JNI_EDETACHED) {
8386 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8388 DO_ASSERT(get_jenv_res == JNI_OK);
8390 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
8391 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
8392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8394 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
8395 if ((*env)->ExceptionCheck(env)) {
8396 (*env)->ExceptionDescribe(env);
8397 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8399 LDKCVec_NodeAnnouncementZ ret_constr;
8400 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8401 if (ret_constr.datalen > 0)
8402 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8404 ret_constr.data = NULL;
8405 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8406 for (size_t s = 0; s < ret_constr.datalen; s++) {
8407 int64_t ret_conv_18 = ret_vals[s];
8408 LDKNodeAnnouncement ret_conv_18_conv;
8409 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8410 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8411 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
8412 ret_constr.data[s] = ret_conv_18_conv;
8414 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8415 if (get_jenv_res == JNI_EDETACHED) {
8416 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8420 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8421 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8423 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8424 if (get_jenv_res == JNI_EDETACHED) {
8425 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8427 DO_ASSERT(get_jenv_res == JNI_OK);
8429 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8430 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8431 LDKInit init_var = *init;
8432 init_var = Init_clone(init);
8433 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8434 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8435 uint64_t init_ref = (uint64_t)init_var.inner;
8436 if (init_var.is_owned) {
8439 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8441 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
8442 if ((*env)->ExceptionCheck(env)) {
8443 (*env)->ExceptionDescribe(env);
8444 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
8446 if (get_jenv_res == JNI_EDETACHED) {
8447 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8450 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8451 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8453 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8454 if (get_jenv_res == JNI_EDETACHED) {
8455 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8457 DO_ASSERT(get_jenv_res == JNI_OK);
8459 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8460 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8461 LDKReplyChannelRange msg_var = msg;
8462 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8463 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8464 uint64_t msg_ref = (uint64_t)msg_var.inner;
8465 if (msg_var.is_owned) {
8468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8470 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8471 if ((*env)->ExceptionCheck(env)) {
8472 (*env)->ExceptionDescribe(env);
8473 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8475 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8476 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8477 if (get_jenv_res == JNI_EDETACHED) {
8478 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8482 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8483 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8485 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8486 if (get_jenv_res == JNI_EDETACHED) {
8487 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8489 DO_ASSERT(get_jenv_res == JNI_OK);
8491 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8492 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8493 LDKReplyShortChannelIdsEnd msg_var = msg;
8494 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8495 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8496 uint64_t msg_ref = (uint64_t)msg_var.inner;
8497 if (msg_var.is_owned) {
8500 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8502 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8503 if ((*env)->ExceptionCheck(env)) {
8504 (*env)->ExceptionDescribe(env);
8505 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
8507 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8508 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8509 if (get_jenv_res == JNI_EDETACHED) {
8510 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8514 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8515 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8517 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8518 if (get_jenv_res == JNI_EDETACHED) {
8519 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8521 DO_ASSERT(get_jenv_res == JNI_OK);
8523 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8524 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8525 LDKQueryChannelRange msg_var = msg;
8526 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8527 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8528 uint64_t msg_ref = (uint64_t)msg_var.inner;
8529 if (msg_var.is_owned) {
8532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8534 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8535 if ((*env)->ExceptionCheck(env)) {
8536 (*env)->ExceptionDescribe(env);
8537 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8539 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8540 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8541 if (get_jenv_res == JNI_EDETACHED) {
8542 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8546 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8547 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8549 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8550 if (get_jenv_res == JNI_EDETACHED) {
8551 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8553 DO_ASSERT(get_jenv_res == JNI_OK);
8555 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8556 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8557 LDKQueryShortChannelIds msg_var = msg;
8558 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8559 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8560 uint64_t msg_ref = (uint64_t)msg_var.inner;
8561 if (msg_var.is_owned) {
8564 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8566 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8567 if ((*env)->ExceptionCheck(env)) {
8568 (*env)->ExceptionDescribe(env);
8569 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
8571 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8572 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8573 if (get_jenv_res == JNI_EDETACHED) {
8574 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8578 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
8579 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
8580 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8581 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8583 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8584 jclass c = (*env)->GetObjectClass(env, o);
8586 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8587 atomic_init(&calls->refcnt, 1);
8588 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8589 calls->o = (*env)->NewWeakGlobalRef(env, o);
8590 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8591 CHECK(calls->handle_node_announcement_meth != NULL);
8592 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8593 CHECK(calls->handle_channel_announcement_meth != NULL);
8594 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8595 CHECK(calls->handle_channel_update_meth != NULL);
8596 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8597 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8598 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8599 CHECK(calls->get_next_channel_announcements_meth != NULL);
8600 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8601 CHECK(calls->get_next_node_announcements_meth != NULL);
8602 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8603 CHECK(calls->sync_routing_table_meth != NULL);
8604 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8605 CHECK(calls->handle_reply_channel_range_meth != NULL);
8606 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8607 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8608 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8609 CHECK(calls->handle_query_channel_range_meth != NULL);
8610 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8611 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8613 LDKRoutingMessageHandler ret = {
8614 .this_arg = (void*) calls,
8615 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8616 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8617 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8618 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8619 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8620 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8621 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8622 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8623 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8624 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8625 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8626 .free = LDKRoutingMessageHandler_JCalls_free,
8627 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8629 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8633 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8634 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8635 return (uint64_t)res_ptr;
8637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8638 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
8639 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8640 DO_ASSERT((res_ptr & 1) == 0);
8641 return (int64_t)(res_ptr | 1);
8643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8644 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8645 LDKNodeAnnouncement msg_conv;
8646 msg_conv.inner = (void*)(msg & (~1));
8647 msg_conv.is_owned = false;
8648 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8649 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8650 return (uint64_t)ret_conv;
8653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8654 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8655 LDKChannelAnnouncement msg_conv;
8656 msg_conv.inner = (void*)(msg & (~1));
8657 msg_conv.is_owned = false;
8658 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8659 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8660 return (uint64_t)ret_conv;
8663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8664 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8665 LDKChannelUpdate msg_conv;
8666 msg_conv.inner = (void*)(msg & (~1));
8667 msg_conv.is_owned = false;
8668 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8669 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8670 return (uint64_t)ret_conv;
8673 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) {
8674 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8675 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8676 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8679 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) {
8680 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8681 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8682 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8683 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8684 for (size_t l = 0; l < ret_var.datalen; l++) {
8685 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8686 *ret_conv_63_ref = ret_var.data[l];
8687 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8689 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8694 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) {
8695 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8696 LDKPublicKey starting_point_ref;
8697 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8698 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8699 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8700 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8701 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8702 for (size_t s = 0; s < ret_var.datalen; s++) {
8703 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8704 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8705 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8706 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8707 if (ret_conv_18_var.is_owned) {
8708 ret_conv_18_ref |= 1;
8710 ret_arr_ptr[s] = ret_conv_18_ref;
8712 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8717 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) {
8718 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8719 LDKPublicKey their_node_id_ref;
8720 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8721 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8723 init_conv.inner = (void*)(init & (~1));
8724 init_conv.is_owned = false;
8725 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8728 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) {
8729 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8730 LDKPublicKey their_node_id_ref;
8731 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8732 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8733 LDKReplyChannelRange msg_conv;
8734 msg_conv.inner = (void*)(msg & (~1));
8735 msg_conv.is_owned = (msg & 1) || (msg == 0);
8736 msg_conv = ReplyChannelRange_clone(&msg_conv);
8737 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8738 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8739 return (uint64_t)ret_conv;
8742 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) {
8743 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8744 LDKPublicKey their_node_id_ref;
8745 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8746 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8747 LDKReplyShortChannelIdsEnd msg_conv;
8748 msg_conv.inner = (void*)(msg & (~1));
8749 msg_conv.is_owned = (msg & 1) || (msg == 0);
8750 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8751 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8752 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8753 return (uint64_t)ret_conv;
8756 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) {
8757 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8758 LDKPublicKey their_node_id_ref;
8759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8761 LDKQueryChannelRange msg_conv;
8762 msg_conv.inner = (void*)(msg & (~1));
8763 msg_conv.is_owned = (msg & 1) || (msg == 0);
8764 msg_conv = QueryChannelRange_clone(&msg_conv);
8765 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8766 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8767 return (uint64_t)ret_conv;
8770 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) {
8771 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8772 LDKPublicKey their_node_id_ref;
8773 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8774 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8775 LDKQueryShortChannelIds msg_conv;
8776 msg_conv.inner = (void*)(msg & (~1));
8777 msg_conv.is_owned = (msg & 1) || (msg == 0);
8778 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8779 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8780 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8781 return (uint64_t)ret_conv;
8784 typedef struct LDKSocketDescriptor_JCalls {
8785 atomic_size_t refcnt;
8788 jmethodID send_data_meth;
8789 jmethodID disconnect_socket_meth;
8791 jmethodID hash_meth;
8792 } LDKSocketDescriptor_JCalls;
8793 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8794 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8795 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8797 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8798 if (get_jenv_res == JNI_EDETACHED) {
8799 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8801 DO_ASSERT(get_jenv_res == JNI_OK);
8803 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8804 if (get_jenv_res == JNI_EDETACHED) {
8805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8810 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8811 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8813 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8814 if (get_jenv_res == JNI_EDETACHED) {
8815 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8817 DO_ASSERT(get_jenv_res == JNI_OK);
8819 LDKu8slice data_var = data;
8820 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8821 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8822 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8824 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8825 if ((*env)->ExceptionCheck(env)) {
8826 (*env)->ExceptionDescribe(env);
8827 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
8829 if (get_jenv_res == JNI_EDETACHED) {
8830 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8834 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8835 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8837 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8838 if (get_jenv_res == JNI_EDETACHED) {
8839 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8841 DO_ASSERT(get_jenv_res == JNI_OK);
8843 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8845 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8846 if ((*env)->ExceptionCheck(env)) {
8847 (*env)->ExceptionDescribe(env);
8848 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
8850 if (get_jenv_res == JNI_EDETACHED) {
8851 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8854 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8855 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8857 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8858 if (get_jenv_res == JNI_EDETACHED) {
8859 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8861 DO_ASSERT(get_jenv_res == JNI_OK);
8863 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8864 *other_arg_clone = SocketDescriptor_clone(other_arg);
8865 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8867 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8868 if ((*env)->ExceptionCheck(env)) {
8869 (*env)->ExceptionDescribe(env);
8870 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
8872 if (get_jenv_res == JNI_EDETACHED) {
8873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8877 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8878 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8880 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8881 if (get_jenv_res == JNI_EDETACHED) {
8882 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8884 DO_ASSERT(get_jenv_res == JNI_OK);
8886 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8888 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8889 if ((*env)->ExceptionCheck(env)) {
8890 (*env)->ExceptionDescribe(env);
8891 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
8893 if (get_jenv_res == JNI_EDETACHED) {
8894 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8898 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8899 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8900 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8902 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8903 jclass c = (*env)->GetObjectClass(env, o);
8905 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8906 atomic_init(&calls->refcnt, 1);
8907 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8908 calls->o = (*env)->NewWeakGlobalRef(env, o);
8909 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8910 CHECK(calls->send_data_meth != NULL);
8911 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8912 CHECK(calls->disconnect_socket_meth != NULL);
8913 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8914 CHECK(calls->eq_meth != NULL);
8915 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8916 CHECK(calls->hash_meth != NULL);
8918 LDKSocketDescriptor ret = {
8919 .this_arg = (void*) calls,
8920 .send_data = send_data_LDKSocketDescriptor_jcall,
8921 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8922 .eq = eq_LDKSocketDescriptor_jcall,
8923 .hash = hash_LDKSocketDescriptor_jcall,
8924 .cloned = LDKSocketDescriptor_JCalls_cloned,
8925 .free = LDKSocketDescriptor_JCalls_free,
8929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8930 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8931 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8932 return (uint64_t)res_ptr;
8934 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) {
8935 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8936 LDKu8slice data_ref;
8937 data_ref.datalen = (*env)->GetArrayLength(env, data);
8938 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8939 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8940 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8945 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8946 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8950 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8951 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8955 typedef struct LDKChannelManagerPersister_JCalls {
8956 atomic_size_t refcnt;
8959 jmethodID persist_manager_meth;
8960 } LDKChannelManagerPersister_JCalls;
8961 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8962 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8963 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8965 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8966 if (get_jenv_res == JNI_EDETACHED) {
8967 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8969 DO_ASSERT(get_jenv_res == JNI_OK);
8971 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8972 if (get_jenv_res == JNI_EDETACHED) {
8973 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8978 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8979 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8981 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8982 if (get_jenv_res == JNI_EDETACHED) {
8983 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8985 DO_ASSERT(get_jenv_res == JNI_OK);
8987 LDKChannelManager channel_manager_var = *channel_manager;
8988 // Warning: we may need a move here but no clone is available for LDKChannelManager
8989 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8990 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8991 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8992 if (channel_manager_var.is_owned) {
8993 channel_manager_ref |= 1;
8995 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8997 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8998 if ((*env)->ExceptionCheck(env)) {
8999 (*env)->ExceptionDescribe(env);
9000 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
9002 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
9003 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
9004 if (get_jenv_res == JNI_EDETACHED) {
9005 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9009 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
9010 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
9011 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9013 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
9014 jclass c = (*env)->GetObjectClass(env, o);
9016 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
9017 atomic_init(&calls->refcnt, 1);
9018 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9019 calls->o = (*env)->NewWeakGlobalRef(env, o);
9020 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
9021 CHECK(calls->persist_manager_meth != NULL);
9023 LDKChannelManagerPersister ret = {
9024 .this_arg = (void*) calls,
9025 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
9026 .free = LDKChannelManagerPersister_JCalls_free,
9030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
9031 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
9032 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
9033 return (uint64_t)res_ptr;
9035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
9036 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
9037 LDKChannelManager channel_manager_conv;
9038 channel_manager_conv.inner = (void*)(channel_manager & (~1));
9039 channel_manager_conv.is_owned = false;
9040 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9041 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9042 return (uint64_t)ret_conv;
9045 static jclass LDKFallback_SegWitProgram_class = NULL;
9046 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
9047 static jclass LDKFallback_PubKeyHash_class = NULL;
9048 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
9049 static jclass LDKFallback_ScriptHash_class = NULL;
9050 static jmethodID LDKFallback_ScriptHash_meth = NULL;
9051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
9052 LDKFallback_SegWitProgram_class =
9053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
9054 CHECK(LDKFallback_SegWitProgram_class != NULL);
9055 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
9056 CHECK(LDKFallback_SegWitProgram_meth != NULL);
9057 LDKFallback_PubKeyHash_class =
9058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
9059 CHECK(LDKFallback_PubKeyHash_class != NULL);
9060 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
9061 CHECK(LDKFallback_PubKeyHash_meth != NULL);
9062 LDKFallback_ScriptHash_class =
9063 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
9064 CHECK(LDKFallback_ScriptHash_class != NULL);
9065 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
9066 CHECK(LDKFallback_ScriptHash_meth != NULL);
9068 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9069 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9071 case LDKFallback_SegWitProgram: {
9072 uint8_t version_val = obj->seg_wit_program.version._0;
9073 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9074 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
9075 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
9076 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
9078 case LDKFallback_PubKeyHash: {
9079 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
9080 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
9081 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
9083 case LDKFallback_ScriptHash: {
9084 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
9085 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
9086 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
9091 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9092 LDKStr ret_str = _ldk_get_compiled_version();
9093 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9098 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9099 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
9100 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9106 LDKTransaction _res_ref;
9107 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9108 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
9109 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9110 _res_ref.data_is_owned = true;
9111 Transaction_free(_res_ref);
9114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
9115 LDKCVec_u8Z script_pubkey_ref;
9116 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9117 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
9118 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
9119 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9120 *ret_ref = TxOut_new(script_pubkey_ref, value);
9121 return (uint64_t)ret_ref;
9124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
9125 if ((_res & 1) != 0) return;
9126 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
9128 TxOut_free(_res_conv);
9131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9132 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
9133 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9134 *ret_ref = TxOut_clone(orig_conv);
9135 return (uint64_t)ret_ref;
9138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
9139 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
9143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9145 CHECK((*env)->GetArrayLength(env, o) == 32);
9146 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
9147 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9148 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
9149 return (uint64_t)ret_conv;
9152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9153 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9154 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9155 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
9156 return (uint64_t)ret_conv;
9159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9160 if ((_res & 1) != 0) return;
9161 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
9163 CResult_SecretKeyErrorZ_free(_res_conv);
9166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9168 CHECK((*env)->GetArrayLength(env, o) == 33);
9169 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
9170 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9171 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
9172 return (uint64_t)ret_conv;
9175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9176 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9177 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9178 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
9179 return (uint64_t)ret_conv;
9182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9183 if ((_res & 1) != 0) return;
9184 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
9186 CResult_PublicKeyErrorZ_free(_res_conv);
9189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9190 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
9191 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9192 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
9193 return (uint64_t)ret_conv;
9196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9197 LDKTxCreationKeys o_conv;
9198 o_conv.inner = (void*)(o & (~1));
9199 o_conv.is_owned = (o & 1) || (o == 0);
9200 o_conv = TxCreationKeys_clone(&o_conv);
9201 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9202 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
9203 return (uint64_t)ret_conv;
9206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9207 LDKDecodeError e_conv;
9208 e_conv.inner = (void*)(e & (~1));
9209 e_conv.is_owned = (e & 1) || (e == 0);
9210 e_conv = DecodeError_clone(&e_conv);
9211 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9212 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9213 return (uint64_t)ret_conv;
9216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9217 if ((_res & 1) != 0) return;
9218 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9220 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9224 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9225 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9226 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9227 return (uint64_t)ret_conv;
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9231 LDKChannelPublicKeys o_conv;
9232 o_conv.inner = (void*)(o & (~1));
9233 o_conv.is_owned = (o & 1) || (o == 0);
9234 o_conv = ChannelPublicKeys_clone(&o_conv);
9235 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9236 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9237 return (uint64_t)ret_conv;
9240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9241 LDKDecodeError e_conv;
9242 e_conv.inner = (void*)(e & (~1));
9243 e_conv.is_owned = (e & 1) || (e == 0);
9244 e_conv = DecodeError_clone(&e_conv);
9245 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9246 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9247 return (uint64_t)ret_conv;
9250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9251 if ((_res & 1) != 0) return;
9252 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9254 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9258 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9259 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9260 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9261 return (uint64_t)ret_conv;
9264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9265 LDKTxCreationKeys o_conv;
9266 o_conv.inner = (void*)(o & (~1));
9267 o_conv.is_owned = (o & 1) || (o == 0);
9268 o_conv = TxCreationKeys_clone(&o_conv);
9269 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9270 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9271 return (uint64_t)ret_conv;
9274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9275 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9276 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9277 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9278 return (uint64_t)ret_conv;
9281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9282 if ((_res & 1) != 0) return;
9283 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
9285 CResult_TxCreationKeysErrorZ_free(_res_conv);
9288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9289 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9290 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9291 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9292 return (uint64_t)ret_conv;
9295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
9296 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9297 *ret_copy = COption_u32Z_some(o);
9298 uint64_t ret_ref = (uint64_t)ret_copy;
9302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
9303 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9304 *ret_copy = COption_u32Z_none();
9305 uint64_t ret_ref = (uint64_t)ret_copy;
9309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9310 if ((_res & 1) != 0) return;
9311 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
9313 COption_u32Z_free(_res_conv);
9316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9317 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9318 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9319 *ret_copy = COption_u32Z_clone(orig_conv);
9320 uint64_t ret_ref = (uint64_t)ret_copy;
9324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9325 LDKHTLCOutputInCommitment o_conv;
9326 o_conv.inner = (void*)(o & (~1));
9327 o_conv.is_owned = (o & 1) || (o == 0);
9328 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9329 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9330 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9331 return (uint64_t)ret_conv;
9334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9335 LDKDecodeError e_conv;
9336 e_conv.inner = (void*)(e & (~1));
9337 e_conv.is_owned = (e & 1) || (e == 0);
9338 e_conv = DecodeError_clone(&e_conv);
9339 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9340 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9341 return (uint64_t)ret_conv;
9344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9345 if ((_res & 1) != 0) return;
9346 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
9348 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9352 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9353 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9354 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9355 return (uint64_t)ret_conv;
9358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9359 LDKCounterpartyChannelTransactionParameters o_conv;
9360 o_conv.inner = (void*)(o & (~1));
9361 o_conv.is_owned = (o & 1) || (o == 0);
9362 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9363 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9364 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9365 return (uint64_t)ret_conv;
9368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9369 LDKDecodeError e_conv;
9370 e_conv.inner = (void*)(e & (~1));
9371 e_conv.is_owned = (e & 1) || (e == 0);
9372 e_conv = DecodeError_clone(&e_conv);
9373 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9374 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9375 return (uint64_t)ret_conv;
9378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9379 if ((_res & 1) != 0) return;
9380 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9382 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9386 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9387 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9388 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9389 return (uint64_t)ret_conv;
9392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9393 LDKChannelTransactionParameters o_conv;
9394 o_conv.inner = (void*)(o & (~1));
9395 o_conv.is_owned = (o & 1) || (o == 0);
9396 o_conv = ChannelTransactionParameters_clone(&o_conv);
9397 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9398 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9399 return (uint64_t)ret_conv;
9402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9403 LDKDecodeError e_conv;
9404 e_conv.inner = (void*)(e & (~1));
9405 e_conv.is_owned = (e & 1) || (e == 0);
9406 e_conv = DecodeError_clone(&e_conv);
9407 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9408 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9409 return (uint64_t)ret_conv;
9412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9413 if ((_res & 1) != 0) return;
9414 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9416 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9420 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9421 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9422 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9423 return (uint64_t)ret_conv;
9426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9427 LDKCVec_SignatureZ _res_constr;
9428 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9429 if (_res_constr.datalen > 0)
9430 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9432 _res_constr.data = NULL;
9433 for (size_t i = 0; i < _res_constr.datalen; i++) {
9434 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9435 LDKSignature _res_conv_8_ref;
9436 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
9437 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
9438 _res_constr.data[i] = _res_conv_8_ref;
9440 CVec_SignatureZ_free(_res_constr);
9443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9444 LDKHolderCommitmentTransaction o_conv;
9445 o_conv.inner = (void*)(o & (~1));
9446 o_conv.is_owned = (o & 1) || (o == 0);
9447 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9448 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9449 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9450 return (uint64_t)ret_conv;
9453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9454 LDKDecodeError e_conv;
9455 e_conv.inner = (void*)(e & (~1));
9456 e_conv.is_owned = (e & 1) || (e == 0);
9457 e_conv = DecodeError_clone(&e_conv);
9458 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9459 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9460 return (uint64_t)ret_conv;
9463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9464 if ((_res & 1) != 0) return;
9465 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9467 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9471 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9472 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9473 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9474 return (uint64_t)ret_conv;
9477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9478 LDKBuiltCommitmentTransaction o_conv;
9479 o_conv.inner = (void*)(o & (~1));
9480 o_conv.is_owned = (o & 1) || (o == 0);
9481 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9482 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9483 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9484 return (uint64_t)ret_conv;
9487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9488 LDKDecodeError e_conv;
9489 e_conv.inner = (void*)(e & (~1));
9490 e_conv.is_owned = (e & 1) || (e == 0);
9491 e_conv = DecodeError_clone(&e_conv);
9492 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9493 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9494 return (uint64_t)ret_conv;
9497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9498 if ((_res & 1) != 0) return;
9499 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9501 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9505 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9506 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9507 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9508 return (uint64_t)ret_conv;
9511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9512 LDKCommitmentTransaction o_conv;
9513 o_conv.inner = (void*)(o & (~1));
9514 o_conv.is_owned = (o & 1) || (o == 0);
9515 o_conv = CommitmentTransaction_clone(&o_conv);
9516 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9517 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9518 return (uint64_t)ret_conv;
9521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9522 LDKDecodeError e_conv;
9523 e_conv.inner = (void*)(e & (~1));
9524 e_conv.is_owned = (e & 1) || (e == 0);
9525 e_conv = DecodeError_clone(&e_conv);
9526 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9527 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9528 return (uint64_t)ret_conv;
9531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9532 if ((_res & 1) != 0) return;
9533 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9535 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9539 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9540 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9541 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9542 return (uint64_t)ret_conv;
9545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9546 LDKTrustedCommitmentTransaction o_conv;
9547 o_conv.inner = (void*)(o & (~1));
9548 o_conv.is_owned = (o & 1) || (o == 0);
9549 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9550 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9551 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9552 return (uint64_t)ret_conv;
9555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9556 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9557 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9558 return (uint64_t)ret_conv;
9561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9562 if ((_res & 1) != 0) return;
9563 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9565 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9569 LDKCVec_SignatureZ o_constr;
9570 o_constr.datalen = (*env)->GetArrayLength(env, o);
9571 if (o_constr.datalen > 0)
9572 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9574 o_constr.data = NULL;
9575 for (size_t i = 0; i < o_constr.datalen; i++) {
9576 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9577 LDKSignature o_conv_8_ref;
9578 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9579 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9580 o_constr.data[i] = o_conv_8_ref;
9582 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9583 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9584 return (uint64_t)ret_conv;
9587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9588 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9589 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9590 return (uint64_t)ret_conv;
9593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9594 if ((_res & 1) != 0) return;
9595 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9597 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9601 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9602 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9603 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9604 return (uint64_t)ret_conv;
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9608 LDKShutdownScript o_conv;
9609 o_conv.inner = (void*)(o & (~1));
9610 o_conv.is_owned = (o & 1) || (o == 0);
9611 o_conv = ShutdownScript_clone(&o_conv);
9612 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9613 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9614 return (uint64_t)ret_conv;
9617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9618 LDKDecodeError e_conv;
9619 e_conv.inner = (void*)(e & (~1));
9620 e_conv.is_owned = (e & 1) || (e == 0);
9621 e_conv = DecodeError_clone(&e_conv);
9622 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9623 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9624 return (uint64_t)ret_conv;
9627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9628 if ((_res & 1) != 0) return;
9629 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
9631 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9635 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9636 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9637 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9638 return (uint64_t)ret_conv;
9641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9642 LDKShutdownScript o_conv;
9643 o_conv.inner = (void*)(o & (~1));
9644 o_conv.is_owned = (o & 1) || (o == 0);
9645 o_conv = ShutdownScript_clone(&o_conv);
9646 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9647 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9648 return (uint64_t)ret_conv;
9651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9652 LDKInvalidShutdownScript e_conv;
9653 e_conv.inner = (void*)(e & (~1));
9654 e_conv.is_owned = (e & 1) || (e == 0);
9655 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
9656 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9657 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9658 return (uint64_t)ret_conv;
9661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9662 if ((_res & 1) != 0) return;
9663 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
9665 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9669 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9670 *ret_conv = CResult_NoneErrorZ_ok();
9671 return (uint64_t)ret_conv;
9674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9675 LDKIOError e_conv = LDKIOError_from_java(env, e);
9676 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9677 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9678 return (uint64_t)ret_conv;
9681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9682 if ((_res & 1) != 0) return;
9683 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9685 CResult_NoneErrorZ_free(_res_conv);
9688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9689 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9690 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9691 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9692 return (uint64_t)ret_conv;
9695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9697 o_conv.inner = (void*)(o & (~1));
9698 o_conv.is_owned = (o & 1) || (o == 0);
9699 o_conv = RouteHop_clone(&o_conv);
9700 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9701 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9702 return (uint64_t)ret_conv;
9705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9706 LDKDecodeError e_conv;
9707 e_conv.inner = (void*)(e & (~1));
9708 e_conv.is_owned = (e & 1) || (e == 0);
9709 e_conv = DecodeError_clone(&e_conv);
9710 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9711 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9712 return (uint64_t)ret_conv;
9715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9716 if ((_res & 1) != 0) return;
9717 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9719 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9723 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9724 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9725 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9726 return (uint64_t)ret_conv;
9729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9730 LDKCVec_RouteHopZ _res_constr;
9731 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9732 if (_res_constr.datalen > 0)
9733 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9735 _res_constr.data = NULL;
9736 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9737 for (size_t k = 0; k < _res_constr.datalen; k++) {
9738 int64_t _res_conv_10 = _res_vals[k];
9739 LDKRouteHop _res_conv_10_conv;
9740 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9741 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9742 _res_constr.data[k] = _res_conv_10_conv;
9744 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9745 CVec_RouteHopZ_free(_res_constr);
9748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9749 LDKCVec_CVec_RouteHopZZ _res_constr;
9750 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9751 if (_res_constr.datalen > 0)
9752 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9754 _res_constr.data = NULL;
9755 for (size_t m = 0; m < _res_constr.datalen; m++) {
9756 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9757 LDKCVec_RouteHopZ _res_conv_12_constr;
9758 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9759 if (_res_conv_12_constr.datalen > 0)
9760 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9762 _res_conv_12_constr.data = NULL;
9763 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9764 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9765 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9766 LDKRouteHop _res_conv_12_conv_10_conv;
9767 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9768 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9769 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9771 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9772 _res_constr.data[m] = _res_conv_12_constr;
9774 CVec_CVec_RouteHopZZ_free(_res_constr);
9777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9779 o_conv.inner = (void*)(o & (~1));
9780 o_conv.is_owned = (o & 1) || (o == 0);
9781 o_conv = Route_clone(&o_conv);
9782 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9783 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9784 return (uint64_t)ret_conv;
9787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9788 LDKDecodeError e_conv;
9789 e_conv.inner = (void*)(e & (~1));
9790 e_conv.is_owned = (e & 1) || (e == 0);
9791 e_conv = DecodeError_clone(&e_conv);
9792 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9793 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9794 return (uint64_t)ret_conv;
9797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9798 if ((_res & 1) != 0) return;
9799 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9801 CResult_RouteDecodeErrorZ_free(_res_conv);
9804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9805 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9806 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9807 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9808 return (uint64_t)ret_conv;
9811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9812 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9813 *ret_copy = COption_u64Z_some(o);
9814 uint64_t ret_ref = (uint64_t)ret_copy;
9818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9819 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9820 *ret_copy = COption_u64Z_none();
9821 uint64_t ret_ref = (uint64_t)ret_copy;
9825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9826 if ((_res & 1) != 0) return;
9827 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9829 COption_u64Z_free(_res_conv);
9832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9833 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9834 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9835 *ret_copy = COption_u64Z_clone(orig_conv);
9836 uint64_t ret_ref = (uint64_t)ret_copy;
9840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9841 LDKCVec_ChannelDetailsZ _res_constr;
9842 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9843 if (_res_constr.datalen > 0)
9844 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9846 _res_constr.data = NULL;
9847 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9848 for (size_t q = 0; q < _res_constr.datalen; q++) {
9849 int64_t _res_conv_16 = _res_vals[q];
9850 LDKChannelDetails _res_conv_16_conv;
9851 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9852 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9853 _res_constr.data[q] = _res_conv_16_conv;
9855 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9856 CVec_ChannelDetailsZ_free(_res_constr);
9859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9860 LDKCVec_RouteHintZ _res_constr;
9861 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9862 if (_res_constr.datalen > 0)
9863 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9865 _res_constr.data = NULL;
9866 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9867 for (size_t l = 0; l < _res_constr.datalen; l++) {
9868 int64_t _res_conv_11 = _res_vals[l];
9869 LDKRouteHint _res_conv_11_conv;
9870 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9871 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9872 _res_constr.data[l] = _res_conv_11_conv;
9874 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9875 CVec_RouteHintZ_free(_res_constr);
9878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9880 o_conv.inner = (void*)(o & (~1));
9881 o_conv.is_owned = (o & 1) || (o == 0);
9882 o_conv = Route_clone(&o_conv);
9883 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9884 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9885 return (uint64_t)ret_conv;
9888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9889 LDKLightningError e_conv;
9890 e_conv.inner = (void*)(e & (~1));
9891 e_conv.is_owned = (e & 1) || (e == 0);
9892 e_conv = LightningError_clone(&e_conv);
9893 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9894 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9895 return (uint64_t)ret_conv;
9898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9899 if ((_res & 1) != 0) return;
9900 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9902 CResult_RouteLightningErrorZ_free(_res_conv);
9905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9906 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9907 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9908 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9909 return (uint64_t)ret_conv;
9912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9913 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9914 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9915 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9916 return (uint64_t)ret_conv;
9919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9920 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9921 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9922 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9923 return (uint64_t)ret_conv;
9926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9927 if ((_res & 1) != 0) return;
9928 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9930 CResult_TxOutAccessErrorZ_free(_res_conv);
9933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9934 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9935 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9936 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9937 return (uint64_t)ret_conv;
9940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9941 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9942 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9943 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9944 return (uint64_t)ret_ref;
9947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9948 LDKTransaction b_ref;
9949 b_ref.datalen = (*env)->GetArrayLength(env, b);
9950 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9951 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9952 b_ref.data_is_owned = true;
9953 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9954 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9955 return (uint64_t)ret_ref;
9958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9959 if ((_res & 1) != 0) return;
9960 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9962 C2Tuple_usizeTransactionZ_free(_res_conv);
9965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9966 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9967 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9968 if (_res_constr.datalen > 0)
9969 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9971 _res_constr.data = NULL;
9972 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9973 for (size_t y = 0; y < _res_constr.datalen; y++) {
9974 int64_t _res_conv_24 = _res_vals[y];
9975 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9976 FREE((void*)_res_conv_24);
9977 _res_constr.data[y] = _res_conv_24_conv;
9979 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9980 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9984 LDKCVec_TxidZ _res_constr;
9985 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9986 if (_res_constr.datalen > 0)
9987 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9989 _res_constr.data = NULL;
9990 for (size_t i = 0; i < _res_constr.datalen; i++) {
9991 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9992 LDKThirtyTwoBytes _res_conv_8_ref;
9993 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9994 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9995 _res_constr.data[i] = _res_conv_8_ref;
9997 CVec_TxidZ_free(_res_constr);
10000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
10001 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10002 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
10003 return (uint64_t)ret_conv;
10006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
10007 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
10008 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10009 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
10010 return (uint64_t)ret_conv;
10013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10014 if ((_res & 1) != 0) return;
10015 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
10017 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
10020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10021 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
10022 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10023 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
10024 return (uint64_t)ret_conv;
10027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10028 LDKCVec_MonitorEventZ _res_constr;
10029 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10030 if (_res_constr.datalen > 0)
10031 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10033 _res_constr.data = NULL;
10034 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10035 for (size_t o = 0; o < _res_constr.datalen; o++) {
10036 int64_t _res_conv_14 = _res_vals[o];
10037 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
10038 FREE((void*)_res_conv_14);
10039 _res_constr.data[o] = _res_conv_14_conv;
10041 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10042 CVec_MonitorEventZ_free(_res_constr);
10045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10046 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
10047 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10048 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
10049 uint64_t ret_ref = (uint64_t)ret_copy;
10053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
10054 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10055 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
10056 uint64_t ret_ref = (uint64_t)ret_copy;
10060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10061 if ((_res & 1) != 0) return;
10062 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
10064 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
10067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10068 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
10069 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10070 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
10071 uint64_t ret_ref = (uint64_t)ret_copy;
10075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10076 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10077 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10078 if (_res_constr.datalen > 0)
10079 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10081 _res_constr.data = NULL;
10082 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10083 for (size_t b = 0; b < _res_constr.datalen; b++) {
10084 int64_t _res_conv_27 = _res_vals[b];
10085 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
10086 FREE((void*)_res_conv_27);
10087 _res_constr.data[b] = _res_conv_27_conv;
10089 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10090 CVec_SpendableOutputDescriptorZ_free(_res_constr);
10093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10094 LDKCVec_MessageSendEventZ _res_constr;
10095 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10096 if (_res_constr.datalen > 0)
10097 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10099 _res_constr.data = NULL;
10100 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10101 for (size_t s = 0; s < _res_constr.datalen; s++) {
10102 int64_t _res_conv_18 = _res_vals[s];
10103 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
10104 FREE((void*)_res_conv_18);
10105 _res_constr.data[s] = _res_conv_18_conv;
10107 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10108 CVec_MessageSendEventZ_free(_res_constr);
10111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10112 LDKInitFeatures o_conv;
10113 o_conv.inner = (void*)(o & (~1));
10114 o_conv.is_owned = (o & 1) || (o == 0);
10115 o_conv = InitFeatures_clone(&o_conv);
10116 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10117 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
10118 return (uint64_t)ret_conv;
10121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10122 LDKDecodeError e_conv;
10123 e_conv.inner = (void*)(e & (~1));
10124 e_conv.is_owned = (e & 1) || (e == 0);
10125 e_conv = DecodeError_clone(&e_conv);
10126 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10127 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
10128 return (uint64_t)ret_conv;
10131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10132 if ((_res & 1) != 0) return;
10133 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10135 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
10138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10139 LDKNodeFeatures o_conv;
10140 o_conv.inner = (void*)(o & (~1));
10141 o_conv.is_owned = (o & 1) || (o == 0);
10142 o_conv = NodeFeatures_clone(&o_conv);
10143 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10144 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
10145 return (uint64_t)ret_conv;
10148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_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_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10154 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
10155 return (uint64_t)ret_conv;
10158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10159 if ((_res & 1) != 0) return;
10160 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10162 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
10165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10166 LDKChannelFeatures o_conv;
10167 o_conv.inner = (void*)(o & (~1));
10168 o_conv.is_owned = (o & 1) || (o == 0);
10169 o_conv = ChannelFeatures_clone(&o_conv);
10170 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10171 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
10172 return (uint64_t)ret_conv;
10175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10176 LDKDecodeError e_conv;
10177 e_conv.inner = (void*)(e & (~1));
10178 e_conv.is_owned = (e & 1) || (e == 0);
10179 e_conv = DecodeError_clone(&e_conv);
10180 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10181 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
10182 return (uint64_t)ret_conv;
10185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10186 if ((_res & 1) != 0) return;
10187 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10189 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10193 LDKInvoiceFeatures o_conv;
10194 o_conv.inner = (void*)(o & (~1));
10195 o_conv.is_owned = (o & 1) || (o == 0);
10196 o_conv = InvoiceFeatures_clone(&o_conv);
10197 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10198 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10199 return (uint64_t)ret_conv;
10202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10203 LDKDecodeError e_conv;
10204 e_conv.inner = (void*)(e & (~1));
10205 e_conv.is_owned = (e & 1) || (e == 0);
10206 e_conv = DecodeError_clone(&e_conv);
10207 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10208 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10209 return (uint64_t)ret_conv;
10212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10213 if ((_res & 1) != 0) return;
10214 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10216 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10220 LDKDelayedPaymentOutputDescriptor o_conv;
10221 o_conv.inner = (void*)(o & (~1));
10222 o_conv.is_owned = (o & 1) || (o == 0);
10223 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10224 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10225 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10226 return (uint64_t)ret_conv;
10229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10230 LDKDecodeError e_conv;
10231 e_conv.inner = (void*)(e & (~1));
10232 e_conv.is_owned = (e & 1) || (e == 0);
10233 e_conv = DecodeError_clone(&e_conv);
10234 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10235 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10236 return (uint64_t)ret_conv;
10239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10240 if ((_res & 1) != 0) return;
10241 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10243 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10247 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10248 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10249 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10250 return (uint64_t)ret_conv;
10253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10254 LDKStaticPaymentOutputDescriptor o_conv;
10255 o_conv.inner = (void*)(o & (~1));
10256 o_conv.is_owned = (o & 1) || (o == 0);
10257 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10258 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10259 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10260 return (uint64_t)ret_conv;
10263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10264 LDKDecodeError e_conv;
10265 e_conv.inner = (void*)(e & (~1));
10266 e_conv.is_owned = (e & 1) || (e == 0);
10267 e_conv = DecodeError_clone(&e_conv);
10268 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10269 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10270 return (uint64_t)ret_conv;
10273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10274 if ((_res & 1) != 0) return;
10275 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10277 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10281 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10282 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10283 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10284 return (uint64_t)ret_conv;
10287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10288 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
10289 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10290 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10291 return (uint64_t)ret_conv;
10294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10295 LDKDecodeError e_conv;
10296 e_conv.inner = (void*)(e & (~1));
10297 e_conv.is_owned = (e & 1) || (e == 0);
10298 e_conv = DecodeError_clone(&e_conv);
10299 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10300 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10301 return (uint64_t)ret_conv;
10304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10305 if ((_res & 1) != 0) return;
10306 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10308 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10312 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10313 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10314 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10315 return (uint64_t)ret_conv;
10318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10319 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10320 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10321 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10322 return (uint64_t)ret_ref;
10325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
10326 LDKSignature a_ref;
10327 CHECK((*env)->GetArrayLength(env, a) == 64);
10328 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
10329 LDKCVec_SignatureZ b_constr;
10330 b_constr.datalen = (*env)->GetArrayLength(env, b);
10331 if (b_constr.datalen > 0)
10332 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10334 b_constr.data = NULL;
10335 for (size_t i = 0; i < b_constr.datalen; i++) {
10336 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
10337 LDKSignature b_conv_8_ref;
10338 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
10339 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
10340 b_constr.data[i] = b_conv_8_ref;
10342 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10343 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10344 return (uint64_t)ret_ref;
10347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10348 if ((_res & 1) != 0) return;
10349 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
10351 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10355 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
10356 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10357 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10358 return (uint64_t)ret_conv;
10361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
10362 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10363 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10364 return (uint64_t)ret_conv;
10367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10368 if ((_res & 1) != 0) return;
10369 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
10371 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10375 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10376 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10377 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10378 return (uint64_t)ret_conv;
10381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10382 LDKSignature o_ref;
10383 CHECK((*env)->GetArrayLength(env, o) == 64);
10384 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
10385 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10386 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10387 return (uint64_t)ret_conv;
10390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10391 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10392 *ret_conv = CResult_SignatureNoneZ_err();
10393 return (uint64_t)ret_conv;
10396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10397 if ((_res & 1) != 0) return;
10398 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
10400 CResult_SignatureNoneZ_free(_res_conv);
10403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10404 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10405 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10406 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10407 return (uint64_t)ret_conv;
10410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10411 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
10412 if (o_conv.free == LDKSign_JCalls_free) {
10413 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10414 LDKSign_JCalls_cloned(&o_conv);
10416 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10417 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10418 return (uint64_t)ret_conv;
10421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10422 LDKDecodeError e_conv;
10423 e_conv.inner = (void*)(e & (~1));
10424 e_conv.is_owned = (e & 1) || (e == 0);
10425 e_conv = DecodeError_clone(&e_conv);
10426 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10427 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10428 return (uint64_t)ret_conv;
10431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10432 if ((_res & 1) != 0) return;
10433 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
10435 CResult_SignDecodeErrorZ_free(_res_conv);
10438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10439 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10440 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10441 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10442 return (uint64_t)ret_conv;
10445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10446 LDKCVec_u8Z _res_ref;
10447 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10448 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10449 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10450 CVec_u8Z_free(_res_ref);
10453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
10454 LDKRecoverableSignature arg_ref;
10455 CHECK((*env)->GetArrayLength(env, arg) == 68);
10456 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
10457 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10458 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10459 return (uint64_t)ret_conv;
10462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10463 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10464 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10465 return (uint64_t)ret_conv;
10468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10469 if ((_res & 1) != 0) return;
10470 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
10472 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10476 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10477 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10478 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10479 return (uint64_t)ret_conv;
10482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10483 LDKCVec_CVec_u8ZZ _res_constr;
10484 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10485 if (_res_constr.datalen > 0)
10486 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10488 _res_constr.data = NULL;
10489 for (size_t i = 0; i < _res_constr.datalen; i++) {
10490 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10491 LDKCVec_u8Z _res_conv_8_ref;
10492 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
10493 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10494 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
10495 _res_constr.data[i] = _res_conv_8_ref;
10497 CVec_CVec_u8ZZ_free(_res_constr);
10500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10501 LDKCVec_CVec_u8ZZ o_constr;
10502 o_constr.datalen = (*env)->GetArrayLength(env, o);
10503 if (o_constr.datalen > 0)
10504 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10506 o_constr.data = NULL;
10507 for (size_t i = 0; i < o_constr.datalen; i++) {
10508 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10509 LDKCVec_u8Z o_conv_8_ref;
10510 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
10511 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10512 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
10513 o_constr.data[i] = o_conv_8_ref;
10515 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10516 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10517 return (uint64_t)ret_conv;
10520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
10521 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10522 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10523 return (uint64_t)ret_conv;
10526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10527 if ((_res & 1) != 0) return;
10528 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
10530 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10534 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10535 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10536 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10537 return (uint64_t)ret_conv;
10540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10541 LDKInMemorySigner o_conv;
10542 o_conv.inner = (void*)(o & (~1));
10543 o_conv.is_owned = (o & 1) || (o == 0);
10544 o_conv = InMemorySigner_clone(&o_conv);
10545 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10546 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10547 return (uint64_t)ret_conv;
10550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10551 LDKDecodeError e_conv;
10552 e_conv.inner = (void*)(e & (~1));
10553 e_conv.is_owned = (e & 1) || (e == 0);
10554 e_conv = DecodeError_clone(&e_conv);
10555 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10556 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10557 return (uint64_t)ret_conv;
10560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10561 if ((_res & 1) != 0) return;
10562 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
10564 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10568 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10569 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10570 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10571 return (uint64_t)ret_conv;
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10575 LDKCVec_TxOutZ _res_constr;
10576 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10577 if (_res_constr.datalen > 0)
10578 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10580 _res_constr.data = NULL;
10581 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10582 for (size_t h = 0; h < _res_constr.datalen; h++) {
10583 int64_t _res_conv_7 = _res_vals[h];
10584 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10585 FREE((void*)_res_conv_7);
10586 _res_constr.data[h] = _res_conv_7_conv;
10588 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10589 CVec_TxOutZ_free(_res_constr);
10592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10593 LDKTransaction o_ref;
10594 o_ref.datalen = (*env)->GetArrayLength(env, o);
10595 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10596 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10597 o_ref.data_is_owned = true;
10598 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10599 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10600 return (uint64_t)ret_conv;
10603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10604 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10605 *ret_conv = CResult_TransactionNoneZ_err();
10606 return (uint64_t)ret_conv;
10609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10610 if ((_res & 1) != 0) return;
10611 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10613 CResult_TransactionNoneZ_free(_res_conv);
10616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10617 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10618 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10619 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10620 return (uint64_t)ret_conv;
10623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10624 LDKThirtyTwoBytes a_ref;
10625 CHECK((*env)->GetArrayLength(env, a) == 32);
10626 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10627 LDKChannelMonitor b_conv;
10628 b_conv.inner = (void*)(b & (~1));
10629 b_conv.is_owned = (b & 1) || (b == 0);
10630 b_conv = ChannelMonitor_clone(&b_conv);
10631 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10632 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10633 return (uint64_t)ret_ref;
10636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10637 if ((_res & 1) != 0) return;
10638 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10640 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10644 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10645 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10646 if (_res_constr.datalen > 0)
10647 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10649 _res_constr.data = NULL;
10650 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10651 for (size_t i = 0; i < _res_constr.datalen; i++) {
10652 int64_t _res_conv_34 = _res_vals[i];
10653 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10654 FREE((void*)_res_conv_34);
10655 _res_constr.data[i] = _res_conv_34_conv;
10657 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10658 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10662 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10663 o_constr.datalen = (*env)->GetArrayLength(env, o);
10664 if (o_constr.datalen > 0)
10665 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10667 o_constr.data = NULL;
10668 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10669 for (size_t i = 0; i < o_constr.datalen; i++) {
10670 int64_t o_conv_34 = o_vals[i];
10671 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10672 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10673 o_constr.data[i] = o_conv_34_conv;
10675 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10676 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10677 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10678 return (uint64_t)ret_conv;
10681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10682 LDKIOError e_conv = LDKIOError_from_java(env, e);
10683 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10684 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10685 return (uint64_t)ret_conv;
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10689 if ((_res & 1) != 0) return;
10690 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10692 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
10696 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10697 *ret_copy = COption_u16Z_some(o);
10698 uint64_t ret_ref = (uint64_t)ret_copy;
10702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
10703 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10704 *ret_copy = COption_u16Z_none();
10705 uint64_t ret_ref = (uint64_t)ret_copy;
10709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10710 if ((_res & 1) != 0) return;
10711 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
10713 COption_u16Z_free(_res_conv);
10716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10717 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10718 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10719 *ret_copy = COption_u16Z_clone(orig_conv);
10720 uint64_t ret_ref = (uint64_t)ret_copy;
10724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10725 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10726 *ret_conv = CResult_NoneAPIErrorZ_ok();
10727 return (uint64_t)ret_conv;
10730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10731 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10732 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10733 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10734 return (uint64_t)ret_conv;
10737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10738 if ((_res & 1) != 0) return;
10739 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10741 CResult_NoneAPIErrorZ_free(_res_conv);
10744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10745 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10746 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10747 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10748 return (uint64_t)ret_conv;
10751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10752 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10753 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10754 if (_res_constr.datalen > 0)
10755 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10757 _res_constr.data = NULL;
10758 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10759 for (size_t w = 0; w < _res_constr.datalen; w++) {
10760 int64_t _res_conv_22 = _res_vals[w];
10761 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10762 FREE((void*)_res_conv_22);
10763 _res_constr.data[w] = _res_conv_22_conv;
10765 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10766 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10770 LDKCVec_APIErrorZ _res_constr;
10771 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10772 if (_res_constr.datalen > 0)
10773 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10775 _res_constr.data = NULL;
10776 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10777 for (size_t k = 0; k < _res_constr.datalen; k++) {
10778 int64_t _res_conv_10 = _res_vals[k];
10779 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10780 FREE((void*)_res_conv_10);
10781 _res_constr.data[k] = _res_conv_10_conv;
10783 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10784 CVec_APIErrorZ_free(_res_constr);
10787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10788 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10789 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10790 return (uint64_t)ret_conv;
10793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10794 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10795 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10796 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10797 return (uint64_t)ret_conv;
10800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10801 if ((_res & 1) != 0) return;
10802 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10804 CResult_NonePaymentSendFailureZ_free(_res_conv);
10807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10808 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10809 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10810 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10811 return (uint64_t)ret_conv;
10814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10815 LDKThirtyTwoBytes o_ref;
10816 CHECK((*env)->GetArrayLength(env, o) == 32);
10817 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10818 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10819 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
10820 return (uint64_t)ret_conv;
10823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10824 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10825 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10826 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
10827 return (uint64_t)ret_conv;
10830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10831 if ((_res & 1) != 0) return;
10832 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10834 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
10837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10838 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
10839 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10840 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
10841 return (uint64_t)ret_conv;
10844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10845 LDKCVec_NetAddressZ _res_constr;
10846 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10847 if (_res_constr.datalen > 0)
10848 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10850 _res_constr.data = NULL;
10851 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10852 for (size_t m = 0; m < _res_constr.datalen; m++) {
10853 int64_t _res_conv_12 = _res_vals[m];
10854 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10855 FREE((void*)_res_conv_12);
10856 _res_constr.data[m] = _res_conv_12_conv;
10858 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10859 CVec_NetAddressZ_free(_res_constr);
10862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10863 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10864 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10865 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10866 return (uint64_t)ret_ref;
10869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10870 LDKThirtyTwoBytes a_ref;
10871 CHECK((*env)->GetArrayLength(env, a) == 32);
10872 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10873 LDKThirtyTwoBytes b_ref;
10874 CHECK((*env)->GetArrayLength(env, b) == 32);
10875 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10876 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10877 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10878 return (uint64_t)ret_ref;
10881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10882 if ((_res & 1) != 0) return;
10883 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10885 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10889 LDKThirtyTwoBytes o_ref;
10890 CHECK((*env)->GetArrayLength(env, o) == 32);
10891 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10892 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10893 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10894 return (uint64_t)ret_conv;
10897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10898 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10899 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10900 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10901 return (uint64_t)ret_conv;
10904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10905 if ((_res & 1) != 0) return;
10906 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10908 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10912 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10913 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10914 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10915 return (uint64_t)ret_conv;
10918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10919 LDKCVec_ChannelMonitorZ _res_constr;
10920 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10921 if (_res_constr.datalen > 0)
10922 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10924 _res_constr.data = NULL;
10925 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10926 for (size_t q = 0; q < _res_constr.datalen; q++) {
10927 int64_t _res_conv_16 = _res_vals[q];
10928 LDKChannelMonitor _res_conv_16_conv;
10929 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10930 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10931 _res_constr.data[q] = _res_conv_16_conv;
10933 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10934 CVec_ChannelMonitorZ_free(_res_constr);
10937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10938 LDKThirtyTwoBytes a_ref;
10939 CHECK((*env)->GetArrayLength(env, a) == 32);
10940 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10941 LDKChannelManager b_conv;
10942 b_conv.inner = (void*)(b & (~1));
10943 b_conv.is_owned = (b & 1) || (b == 0);
10944 // Warning: we need a move here but no clone is available for LDKChannelManager
10945 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10946 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10947 return (uint64_t)ret_ref;
10950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10951 if ((_res & 1) != 0) return;
10952 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10954 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10958 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10959 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10960 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10961 return (uint64_t)ret_conv;
10964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10965 LDKDecodeError e_conv;
10966 e_conv.inner = (void*)(e & (~1));
10967 e_conv.is_owned = (e & 1) || (e == 0);
10968 e_conv = DecodeError_clone(&e_conv);
10969 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10970 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10971 return (uint64_t)ret_conv;
10974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10975 if ((_res & 1) != 0) return;
10976 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10978 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10982 LDKChannelConfig o_conv;
10983 o_conv.inner = (void*)(o & (~1));
10984 o_conv.is_owned = (o & 1) || (o == 0);
10985 o_conv = ChannelConfig_clone(&o_conv);
10986 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10987 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10988 return (uint64_t)ret_conv;
10991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10992 LDKDecodeError e_conv;
10993 e_conv.inner = (void*)(e & (~1));
10994 e_conv.is_owned = (e & 1) || (e == 0);
10995 e_conv = DecodeError_clone(&e_conv);
10996 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10997 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10998 return (uint64_t)ret_conv;
11001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11002 if ((_res & 1) != 0) return;
11003 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
11005 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11009 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11010 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11011 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11012 return (uint64_t)ret_conv;
11015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11016 LDKOutPoint o_conv;
11017 o_conv.inner = (void*)(o & (~1));
11018 o_conv.is_owned = (o & 1) || (o == 0);
11019 o_conv = OutPoint_clone(&o_conv);
11020 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11021 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11022 return (uint64_t)ret_conv;
11025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11026 LDKDecodeError e_conv;
11027 e_conv.inner = (void*)(e & (~1));
11028 e_conv.is_owned = (e & 1) || (e == 0);
11029 e_conv = DecodeError_clone(&e_conv);
11030 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11031 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11032 return (uint64_t)ret_conv;
11035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11036 if ((_res & 1) != 0) return;
11037 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
11039 CResult_OutPointDecodeErrorZ_free(_res_conv);
11042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11043 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11044 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11045 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11046 return (uint64_t)ret_conv;
11049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
11050 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
11051 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11052 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
11053 return (uint64_t)ret_conv;
11056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
11057 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11058 *ret_conv = CResult_SiPrefixNoneZ_err();
11059 return (uint64_t)ret_conv;
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11063 if ((_res & 1) != 0) return;
11064 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
11066 CResult_SiPrefixNoneZ_free(_res_conv);
11069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11070 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11071 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11072 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11073 return (uint64_t)ret_conv;
11076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11078 o_conv.inner = (void*)(o & (~1));
11079 o_conv.is_owned = (o & 1) || (o == 0);
11080 o_conv = Invoice_clone(&o_conv);
11081 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11082 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11083 return (uint64_t)ret_conv;
11086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11087 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11088 *ret_conv = CResult_InvoiceNoneZ_err();
11089 return (uint64_t)ret_conv;
11092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11093 if ((_res & 1) != 0) return;
11094 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
11096 CResult_InvoiceNoneZ_free(_res_conv);
11099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11100 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11101 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11102 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11103 return (uint64_t)ret_conv;
11106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11107 LDKSignedRawInvoice o_conv;
11108 o_conv.inner = (void*)(o & (~1));
11109 o_conv.is_owned = (o & 1) || (o == 0);
11110 o_conv = SignedRawInvoice_clone(&o_conv);
11111 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11112 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11113 return (uint64_t)ret_conv;
11116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11117 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11118 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11119 return (uint64_t)ret_conv;
11122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11123 if ((_res & 1) != 0) return;
11124 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
11126 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11130 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11131 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11132 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11133 return (uint64_t)ret_conv;
11136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11137 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11138 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11139 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11140 return (uint64_t)ret_ref;
11143 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) {
11144 LDKRawInvoice a_conv;
11145 a_conv.inner = (void*)(a & (~1));
11146 a_conv.is_owned = (a & 1) || (a == 0);
11147 a_conv = RawInvoice_clone(&a_conv);
11148 LDKThirtyTwoBytes b_ref;
11149 CHECK((*env)->GetArrayLength(env, b) == 32);
11150 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11151 LDKInvoiceSignature c_conv;
11152 c_conv.inner = (void*)(c & (~1));
11153 c_conv.is_owned = (c & 1) || (c == 0);
11154 c_conv = InvoiceSignature_clone(&c_conv);
11155 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11156 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11157 return (uint64_t)ret_ref;
11160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11161 if ((_res & 1) != 0) return;
11162 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
11164 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11168 LDKPayeePubKey o_conv;
11169 o_conv.inner = (void*)(o & (~1));
11170 o_conv.is_owned = (o & 1) || (o == 0);
11171 o_conv = PayeePubKey_clone(&o_conv);
11172 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11173 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11174 return (uint64_t)ret_conv;
11177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11178 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11179 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11180 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11181 return (uint64_t)ret_conv;
11184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11185 if ((_res & 1) != 0) return;
11186 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
11188 CResult_PayeePubKeyErrorZ_free(_res_conv);
11191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11192 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11193 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11194 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11195 return (uint64_t)ret_conv;
11198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11199 LDKCVec_PrivateRouteZ _res_constr;
11200 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11201 if (_res_constr.datalen > 0)
11202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11204 _res_constr.data = NULL;
11205 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11206 for (size_t o = 0; o < _res_constr.datalen; o++) {
11207 int64_t _res_conv_14 = _res_vals[o];
11208 LDKPrivateRoute _res_conv_14_conv;
11209 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11210 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11211 _res_constr.data[o] = _res_conv_14_conv;
11213 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11214 CVec_PrivateRouteZ_free(_res_constr);
11217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11218 LDKPositiveTimestamp o_conv;
11219 o_conv.inner = (void*)(o & (~1));
11220 o_conv.is_owned = (o & 1) || (o == 0);
11221 o_conv = PositiveTimestamp_clone(&o_conv);
11222 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11223 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
11224 return (uint64_t)ret_conv;
11227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11228 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11229 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11230 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
11231 return (uint64_t)ret_conv;
11234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11235 if ((_res & 1) != 0) return;
11236 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
11238 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
11241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11242 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
11243 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11244 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
11245 return (uint64_t)ret_conv;
11248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
11249 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11250 *ret_conv = CResult_NoneSemanticErrorZ_ok();
11251 return (uint64_t)ret_conv;
11254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11255 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11256 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11257 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
11258 return (uint64_t)ret_conv;
11261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11262 if ((_res & 1) != 0) return;
11263 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
11265 CResult_NoneSemanticErrorZ_free(_res_conv);
11268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11269 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
11270 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11271 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
11272 return (uint64_t)ret_conv;
11275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11277 o_conv.inner = (void*)(o & (~1));
11278 o_conv.is_owned = (o & 1) || (o == 0);
11279 o_conv = Invoice_clone(&o_conv);
11280 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11281 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
11282 return (uint64_t)ret_conv;
11285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11286 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11287 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11288 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
11289 return (uint64_t)ret_conv;
11292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11293 if ((_res & 1) != 0) return;
11294 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
11296 CResult_InvoiceSemanticErrorZ_free(_res_conv);
11299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11300 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
11301 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11302 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
11303 return (uint64_t)ret_conv;
11306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11307 LDKDescription o_conv;
11308 o_conv.inner = (void*)(o & (~1));
11309 o_conv.is_owned = (o & 1) || (o == 0);
11310 o_conv = Description_clone(&o_conv);
11311 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11312 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
11313 return (uint64_t)ret_conv;
11316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11317 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11318 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11319 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
11320 return (uint64_t)ret_conv;
11323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11324 if ((_res & 1) != 0) return;
11325 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
11327 CResult_DescriptionCreationErrorZ_free(_res_conv);
11330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11331 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11332 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11333 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11334 return (uint64_t)ret_conv;
11337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11338 LDKExpiryTime o_conv;
11339 o_conv.inner = (void*)(o & (~1));
11340 o_conv.is_owned = (o & 1) || (o == 0);
11341 o_conv = ExpiryTime_clone(&o_conv);
11342 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11343 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11344 return (uint64_t)ret_conv;
11347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11348 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11349 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11350 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11351 return (uint64_t)ret_conv;
11354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11355 if ((_res & 1) != 0) return;
11356 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
11358 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11362 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11363 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11364 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11365 return (uint64_t)ret_conv;
11368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11369 LDKPrivateRoute o_conv;
11370 o_conv.inner = (void*)(o & (~1));
11371 o_conv.is_owned = (o & 1) || (o == 0);
11372 o_conv = PrivateRoute_clone(&o_conv);
11373 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11374 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11375 return (uint64_t)ret_conv;
11378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11379 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11380 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11381 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11382 return (uint64_t)ret_conv;
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11386 if ((_res & 1) != 0) return;
11387 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
11389 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11393 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11394 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11395 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11396 return (uint64_t)ret_conv;
11399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
11400 LDKStr o_conv = java_to_owned_str(env, o);
11401 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11402 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11403 return (uint64_t)ret_conv;
11406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11407 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11408 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11409 *ret_conv = CResult_StringErrorZ_err(e_conv);
11410 return (uint64_t)ret_conv;
11413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11414 if ((_res & 1) != 0) return;
11415 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
11417 CResult_StringErrorZ_free(_res_conv);
11420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11421 LDKChannelMonitorUpdate o_conv;
11422 o_conv.inner = (void*)(o & (~1));
11423 o_conv.is_owned = (o & 1) || (o == 0);
11424 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11425 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11426 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11427 return (uint64_t)ret_conv;
11430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11431 LDKDecodeError e_conv;
11432 e_conv.inner = (void*)(e & (~1));
11433 e_conv.is_owned = (e & 1) || (e == 0);
11434 e_conv = DecodeError_clone(&e_conv);
11435 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11436 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11437 return (uint64_t)ret_conv;
11440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11441 if ((_res & 1) != 0) return;
11442 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11444 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11448 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11449 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11450 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11451 return (uint64_t)ret_conv;
11454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11455 LDKHTLCUpdate o_conv;
11456 o_conv.inner = (void*)(o & (~1));
11457 o_conv.is_owned = (o & 1) || (o == 0);
11458 o_conv = HTLCUpdate_clone(&o_conv);
11459 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11460 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11461 return (uint64_t)ret_conv;
11464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11465 LDKDecodeError e_conv;
11466 e_conv.inner = (void*)(e & (~1));
11467 e_conv.is_owned = (e & 1) || (e == 0);
11468 e_conv = DecodeError_clone(&e_conv);
11469 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11470 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11471 return (uint64_t)ret_conv;
11474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11475 if ((_res & 1) != 0) return;
11476 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11478 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11482 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11483 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11484 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11485 return (uint64_t)ret_conv;
11488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
11489 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11490 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11491 return (uint64_t)ret_conv;
11494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11495 LDKMonitorUpdateError e_conv;
11496 e_conv.inner = (void*)(e & (~1));
11497 e_conv.is_owned = (e & 1) || (e == 0);
11498 e_conv = MonitorUpdateError_clone(&e_conv);
11499 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11500 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11501 return (uint64_t)ret_conv;
11504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11505 if ((_res & 1) != 0) return;
11506 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
11508 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11512 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11513 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11514 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11515 return (uint64_t)ret_conv;
11518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11519 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11520 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11521 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
11522 return (uint64_t)ret_ref;
11525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11526 LDKOutPoint a_conv;
11527 a_conv.inner = (void*)(a & (~1));
11528 a_conv.is_owned = (a & 1) || (a == 0);
11529 a_conv = OutPoint_clone(&a_conv);
11531 b_ref.datalen = (*env)->GetArrayLength(env, b);
11532 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11533 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11534 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11535 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11536 return (uint64_t)ret_ref;
11539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11540 if ((_res & 1) != 0) return;
11541 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
11543 C2Tuple_OutPointScriptZ_free(_res_conv);
11546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11547 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11548 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11549 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
11550 return (uint64_t)ret_ref;
11553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
11555 b_ref.datalen = (*env)->GetArrayLength(env, b);
11556 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11557 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11558 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11559 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
11560 return (uint64_t)ret_ref;
11563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11564 if ((_res & 1) != 0) return;
11565 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
11567 C2Tuple_u32ScriptZ_free(_res_conv);
11570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11571 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11572 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11573 if (_res_constr.datalen > 0)
11574 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11576 _res_constr.data = NULL;
11577 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11578 for (size_t b = 0; b < _res_constr.datalen; b++) {
11579 int64_t _res_conv_27 = _res_vals[b];
11580 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
11581 FREE((void*)_res_conv_27);
11582 _res_constr.data[b] = _res_conv_27_conv;
11584 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11585 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11589 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11590 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11591 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11592 return (uint64_t)ret_ref;
11595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11596 LDKThirtyTwoBytes a_ref;
11597 CHECK((*env)->GetArrayLength(env, a) == 32);
11598 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11599 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11600 b_constr.datalen = (*env)->GetArrayLength(env, b);
11601 if (b_constr.datalen > 0)
11602 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11604 b_constr.data = NULL;
11605 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11606 for (size_t b = 0; b < b_constr.datalen; b++) {
11607 int64_t b_conv_27 = b_vals[b];
11608 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
11609 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
11610 b_constr.data[b] = b_conv_27_conv;
11612 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11613 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11614 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11615 return (uint64_t)ret_ref;
11618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11619 if ((_res & 1) != 0) return;
11620 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
11622 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11626 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11627 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11628 if (_res_constr.datalen > 0)
11629 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11631 _res_constr.data = NULL;
11632 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11633 for (size_t v = 0; v < _res_constr.datalen; v++) {
11634 int64_t _res_conv_47 = _res_vals[v];
11635 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11636 FREE((void*)_res_conv_47);
11637 _res_constr.data[v] = _res_conv_47_conv;
11639 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11640 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11644 LDKCVec_EventZ _res_constr;
11645 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11646 if (_res_constr.datalen > 0)
11647 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11649 _res_constr.data = NULL;
11650 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11651 for (size_t h = 0; h < _res_constr.datalen; h++) {
11652 int64_t _res_conv_7 = _res_vals[h];
11653 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11654 FREE((void*)_res_conv_7);
11655 _res_constr.data[h] = _res_conv_7_conv;
11657 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11658 CVec_EventZ_free(_res_constr);
11661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11662 LDKCVec_TransactionZ _res_constr;
11663 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11664 if (_res_constr.datalen > 0)
11665 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11667 _res_constr.data = NULL;
11668 for (size_t i = 0; i < _res_constr.datalen; i++) {
11669 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11670 LDKTransaction _res_conv_8_ref;
11671 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11672 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11673 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11674 _res_conv_8_ref.data_is_owned = true;
11675 _res_constr.data[i] = _res_conv_8_ref;
11677 CVec_TransactionZ_free(_res_constr);
11680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11681 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11682 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11683 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11684 return (uint64_t)ret_ref;
11687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11688 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11689 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11690 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11691 return (uint64_t)ret_ref;
11694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11695 if ((_res & 1) != 0) return;
11696 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11698 C2Tuple_u32TxOutZ_free(_res_conv);
11701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11702 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11703 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11704 if (_res_constr.datalen > 0)
11705 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11707 _res_constr.data = NULL;
11708 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11709 for (size_t a = 0; a < _res_constr.datalen; a++) {
11710 int64_t _res_conv_26 = _res_vals[a];
11711 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11712 FREE((void*)_res_conv_26);
11713 _res_constr.data[a] = _res_conv_26_conv;
11715 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11716 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11720 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11721 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11722 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11723 return (uint64_t)ret_ref;
11726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11727 LDKThirtyTwoBytes a_ref;
11728 CHECK((*env)->GetArrayLength(env, a) == 32);
11729 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11730 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11731 b_constr.datalen = (*env)->GetArrayLength(env, b);
11732 if (b_constr.datalen > 0)
11733 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11735 b_constr.data = NULL;
11736 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11737 for (size_t a = 0; a < b_constr.datalen; a++) {
11738 int64_t b_conv_26 = b_vals[a];
11739 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11740 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11741 b_constr.data[a] = b_conv_26_conv;
11743 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11744 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11745 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11746 return (uint64_t)ret_ref;
11749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11750 if ((_res & 1) != 0) return;
11751 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11753 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11757 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11758 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11759 if (_res_constr.datalen > 0)
11760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11762 _res_constr.data = NULL;
11763 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11764 for (size_t u = 0; u < _res_constr.datalen; u++) {
11765 int64_t _res_conv_46 = _res_vals[u];
11766 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11767 FREE((void*)_res_conv_46);
11768 _res_constr.data[u] = _res_conv_46_conv;
11770 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11771 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11775 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11776 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11777 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11778 return (uint64_t)ret_conv;
11781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11782 LDKDecodeError e_conv;
11783 e_conv.inner = (void*)(e & (~1));
11784 e_conv.is_owned = (e & 1) || (e == 0);
11785 e_conv = DecodeError_clone(&e_conv);
11786 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11787 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11788 return (uint64_t)ret_conv;
11791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11792 if ((_res & 1) != 0) return;
11793 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11795 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11799 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11800 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11801 return (uint64_t)ret_conv;
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11805 LDKLightningError e_conv;
11806 e_conv.inner = (void*)(e & (~1));
11807 e_conv.is_owned = (e & 1) || (e == 0);
11808 e_conv = LightningError_clone(&e_conv);
11809 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11810 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11811 return (uint64_t)ret_conv;
11814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11815 if ((_res & 1) != 0) return;
11816 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11818 CResult_boolLightningErrorZ_free(_res_conv);
11821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11822 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11823 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11824 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11825 return (uint64_t)ret_conv;
11828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11829 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11830 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11831 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11832 return (uint64_t)ret_ref;
11835 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) {
11836 LDKChannelAnnouncement a_conv;
11837 a_conv.inner = (void*)(a & (~1));
11838 a_conv.is_owned = (a & 1) || (a == 0);
11839 a_conv = ChannelAnnouncement_clone(&a_conv);
11840 LDKChannelUpdate b_conv;
11841 b_conv.inner = (void*)(b & (~1));
11842 b_conv.is_owned = (b & 1) || (b == 0);
11843 b_conv = ChannelUpdate_clone(&b_conv);
11844 LDKChannelUpdate c_conv;
11845 c_conv.inner = (void*)(c & (~1));
11846 c_conv.is_owned = (c & 1) || (c == 0);
11847 c_conv = ChannelUpdate_clone(&c_conv);
11848 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11849 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11850 return (uint64_t)ret_ref;
11853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11854 if ((_res & 1) != 0) return;
11855 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11857 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11861 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11862 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11863 if (_res_constr.datalen > 0)
11864 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11866 _res_constr.data = NULL;
11867 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11868 for (size_t l = 0; l < _res_constr.datalen; l++) {
11869 int64_t _res_conv_63 = _res_vals[l];
11870 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11871 FREE((void*)_res_conv_63);
11872 _res_constr.data[l] = _res_conv_63_conv;
11874 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11875 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11879 LDKCVec_NodeAnnouncementZ _res_constr;
11880 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11881 if (_res_constr.datalen > 0)
11882 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11884 _res_constr.data = NULL;
11885 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11886 for (size_t s = 0; s < _res_constr.datalen; s++) {
11887 int64_t _res_conv_18 = _res_vals[s];
11888 LDKNodeAnnouncement _res_conv_18_conv;
11889 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11890 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11891 _res_constr.data[s] = _res_conv_18_conv;
11893 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11894 CVec_NodeAnnouncementZ_free(_res_constr);
11897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11898 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11899 *ret_conv = CResult_NoneLightningErrorZ_ok();
11900 return (uint64_t)ret_conv;
11903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11904 LDKLightningError e_conv;
11905 e_conv.inner = (void*)(e & (~1));
11906 e_conv.is_owned = (e & 1) || (e == 0);
11907 e_conv = LightningError_clone(&e_conv);
11908 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11909 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11910 return (uint64_t)ret_conv;
11913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11914 if ((_res & 1) != 0) return;
11915 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11917 CResult_NoneLightningErrorZ_free(_res_conv);
11920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11921 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11922 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11923 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11924 return (uint64_t)ret_conv;
11927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11928 LDKCVec_PublicKeyZ _res_constr;
11929 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11930 if (_res_constr.datalen > 0)
11931 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11933 _res_constr.data = NULL;
11934 for (size_t i = 0; i < _res_constr.datalen; i++) {
11935 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11936 LDKPublicKey _res_conv_8_ref;
11937 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11938 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11939 _res_constr.data[i] = _res_conv_8_ref;
11941 CVec_PublicKeyZ_free(_res_constr);
11944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11946 o_ref.datalen = (*env)->GetArrayLength(env, o);
11947 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11948 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11949 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11950 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11951 return (uint64_t)ret_conv;
11954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11955 LDKPeerHandleError e_conv;
11956 e_conv.inner = (void*)(e & (~1));
11957 e_conv.is_owned = (e & 1) || (e == 0);
11958 e_conv = PeerHandleError_clone(&e_conv);
11959 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11960 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11961 return (uint64_t)ret_conv;
11964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11965 if ((_res & 1) != 0) return;
11966 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11968 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11972 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11973 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11974 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11975 return (uint64_t)ret_conv;
11978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11979 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11980 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11981 return (uint64_t)ret_conv;
11984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11985 LDKPeerHandleError e_conv;
11986 e_conv.inner = (void*)(e & (~1));
11987 e_conv.is_owned = (e & 1) || (e == 0);
11988 e_conv = PeerHandleError_clone(&e_conv);
11989 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11990 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11991 return (uint64_t)ret_conv;
11994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11995 if ((_res & 1) != 0) return;
11996 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11998 CResult_NonePeerHandleErrorZ_free(_res_conv);
12001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12002 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
12003 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12004 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
12005 return (uint64_t)ret_conv;
12008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
12009 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12010 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
12011 return (uint64_t)ret_conv;
12014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12015 LDKPeerHandleError e_conv;
12016 e_conv.inner = (void*)(e & (~1));
12017 e_conv.is_owned = (e & 1) || (e == 0);
12018 e_conv = PeerHandleError_clone(&e_conv);
12019 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12020 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
12021 return (uint64_t)ret_conv;
12024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12025 if ((_res & 1) != 0) return;
12026 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
12028 CResult_boolPeerHandleErrorZ_free(_res_conv);
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12032 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
12033 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12034 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
12035 return (uint64_t)ret_conv;
12038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12039 LDKDirectionalChannelInfo o_conv;
12040 o_conv.inner = (void*)(o & (~1));
12041 o_conv.is_owned = (o & 1) || (o == 0);
12042 o_conv = DirectionalChannelInfo_clone(&o_conv);
12043 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12044 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12045 return (uint64_t)ret_conv;
12048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12049 LDKDecodeError e_conv;
12050 e_conv.inner = (void*)(e & (~1));
12051 e_conv.is_owned = (e & 1) || (e == 0);
12052 e_conv = DecodeError_clone(&e_conv);
12053 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12054 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12055 return (uint64_t)ret_conv;
12058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12059 if ((_res & 1) != 0) return;
12060 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12062 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12066 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12067 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12068 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12069 return (uint64_t)ret_conv;
12072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12073 LDKChannelInfo o_conv;
12074 o_conv.inner = (void*)(o & (~1));
12075 o_conv.is_owned = (o & 1) || (o == 0);
12076 o_conv = ChannelInfo_clone(&o_conv);
12077 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12078 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12079 return (uint64_t)ret_conv;
12082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12083 LDKDecodeError e_conv;
12084 e_conv.inner = (void*)(e & (~1));
12085 e_conv.is_owned = (e & 1) || (e == 0);
12086 e_conv = DecodeError_clone(&e_conv);
12087 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12088 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12089 return (uint64_t)ret_conv;
12092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12093 if ((_res & 1) != 0) return;
12094 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12096 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12100 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12101 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12102 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12103 return (uint64_t)ret_conv;
12106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12107 LDKRoutingFees o_conv;
12108 o_conv.inner = (void*)(o & (~1));
12109 o_conv.is_owned = (o & 1) || (o == 0);
12110 o_conv = RoutingFees_clone(&o_conv);
12111 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12112 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12113 return (uint64_t)ret_conv;
12116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12117 LDKDecodeError e_conv;
12118 e_conv.inner = (void*)(e & (~1));
12119 e_conv.is_owned = (e & 1) || (e == 0);
12120 e_conv = DecodeError_clone(&e_conv);
12121 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12122 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12123 return (uint64_t)ret_conv;
12126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12127 if ((_res & 1) != 0) return;
12128 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12130 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12134 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12135 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12136 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12137 return (uint64_t)ret_conv;
12140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12141 LDKNodeAnnouncementInfo o_conv;
12142 o_conv.inner = (void*)(o & (~1));
12143 o_conv.is_owned = (o & 1) || (o == 0);
12144 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12145 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12146 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12147 return (uint64_t)ret_conv;
12150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12151 LDKDecodeError e_conv;
12152 e_conv.inner = (void*)(e & (~1));
12153 e_conv.is_owned = (e & 1) || (e == 0);
12154 e_conv = DecodeError_clone(&e_conv);
12155 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12156 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12157 return (uint64_t)ret_conv;
12160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12161 if ((_res & 1) != 0) return;
12162 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12164 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12168 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12169 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12170 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12171 return (uint64_t)ret_conv;
12174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12175 LDKCVec_u64Z _res_constr;
12176 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12177 if (_res_constr.datalen > 0)
12178 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12180 _res_constr.data = NULL;
12181 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12182 for (size_t g = 0; g < _res_constr.datalen; g++) {
12183 int64_t _res_conv_6 = _res_vals[g];
12184 _res_constr.data[g] = _res_conv_6;
12186 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12187 CVec_u64Z_free(_res_constr);
12190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12191 LDKNodeInfo o_conv;
12192 o_conv.inner = (void*)(o & (~1));
12193 o_conv.is_owned = (o & 1) || (o == 0);
12194 o_conv = NodeInfo_clone(&o_conv);
12195 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12196 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12197 return (uint64_t)ret_conv;
12200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12201 LDKDecodeError e_conv;
12202 e_conv.inner = (void*)(e & (~1));
12203 e_conv.is_owned = (e & 1) || (e == 0);
12204 e_conv = DecodeError_clone(&e_conv);
12205 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12206 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12207 return (uint64_t)ret_conv;
12210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12211 if ((_res & 1) != 0) return;
12212 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12214 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12218 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12219 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12220 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12221 return (uint64_t)ret_conv;
12224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12225 LDKNetworkGraph o_conv;
12226 o_conv.inner = (void*)(o & (~1));
12227 o_conv.is_owned = (o & 1) || (o == 0);
12228 o_conv = NetworkGraph_clone(&o_conv);
12229 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12230 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12231 return (uint64_t)ret_conv;
12234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12235 LDKDecodeError e_conv;
12236 e_conv.inner = (void*)(e & (~1));
12237 e_conv.is_owned = (e & 1) || (e == 0);
12238 e_conv = DecodeError_clone(&e_conv);
12239 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12240 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12241 return (uint64_t)ret_conv;
12244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12245 if ((_res & 1) != 0) return;
12246 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
12248 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12252 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12253 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12254 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12255 return (uint64_t)ret_conv;
12258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
12259 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12260 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12261 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
12262 return (uint64_t)ret_conv;
12265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
12266 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12267 *ret_conv = CResult_NetAddressu8Z_err(e);
12268 return (uint64_t)ret_conv;
12271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12272 if ((_res & 1) != 0) return;
12273 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
12275 CResult_NetAddressu8Z_free(_res_conv);
12278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12279 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
12280 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12281 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
12282 return (uint64_t)ret_conv;
12285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12286 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
12287 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12288 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
12289 return (uint64_t)ret_conv;
12292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12293 LDKDecodeError e_conv;
12294 e_conv.inner = (void*)(e & (~1));
12295 e_conv.is_owned = (e & 1) || (e == 0);
12296 e_conv = DecodeError_clone(&e_conv);
12297 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12298 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
12299 return (uint64_t)ret_conv;
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12303 if ((_res & 1) != 0) return;
12304 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12306 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
12309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12310 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
12311 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12312 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
12313 return (uint64_t)ret_conv;
12316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12317 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12318 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12319 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12320 return (uint64_t)ret_conv;
12323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12324 LDKDecodeError e_conv;
12325 e_conv.inner = (void*)(e & (~1));
12326 e_conv.is_owned = (e & 1) || (e == 0);
12327 e_conv = DecodeError_clone(&e_conv);
12328 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12329 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12330 return (uint64_t)ret_conv;
12333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12334 if ((_res & 1) != 0) return;
12335 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
12337 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12341 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12342 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12343 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12344 return (uint64_t)ret_conv;
12347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12348 LDKCVec_UpdateAddHTLCZ _res_constr;
12349 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12350 if (_res_constr.datalen > 0)
12351 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12353 _res_constr.data = NULL;
12354 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12355 for (size_t p = 0; p < _res_constr.datalen; p++) {
12356 int64_t _res_conv_15 = _res_vals[p];
12357 LDKUpdateAddHTLC _res_conv_15_conv;
12358 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12359 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12360 _res_constr.data[p] = _res_conv_15_conv;
12362 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12363 CVec_UpdateAddHTLCZ_free(_res_constr);
12366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12367 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12368 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12369 if (_res_constr.datalen > 0)
12370 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12372 _res_constr.data = NULL;
12373 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12374 for (size_t t = 0; t < _res_constr.datalen; t++) {
12375 int64_t _res_conv_19 = _res_vals[t];
12376 LDKUpdateFulfillHTLC _res_conv_19_conv;
12377 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12378 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12379 _res_constr.data[t] = _res_conv_19_conv;
12381 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12382 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12386 LDKCVec_UpdateFailHTLCZ _res_constr;
12387 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12388 if (_res_constr.datalen > 0)
12389 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12391 _res_constr.data = NULL;
12392 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12393 for (size_t q = 0; q < _res_constr.datalen; q++) {
12394 int64_t _res_conv_16 = _res_vals[q];
12395 LDKUpdateFailHTLC _res_conv_16_conv;
12396 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12397 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12398 _res_constr.data[q] = _res_conv_16_conv;
12400 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12401 CVec_UpdateFailHTLCZ_free(_res_constr);
12404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12405 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12406 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12407 if (_res_constr.datalen > 0)
12408 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12410 _res_constr.data = NULL;
12411 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12412 for (size_t z = 0; z < _res_constr.datalen; z++) {
12413 int64_t _res_conv_25 = _res_vals[z];
12414 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12415 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12416 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12417 _res_constr.data[z] = _res_conv_25_conv;
12419 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12420 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12424 LDKAcceptChannel o_conv;
12425 o_conv.inner = (void*)(o & (~1));
12426 o_conv.is_owned = (o & 1) || (o == 0);
12427 o_conv = AcceptChannel_clone(&o_conv);
12428 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12429 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12430 return (uint64_t)ret_conv;
12433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12434 LDKDecodeError e_conv;
12435 e_conv.inner = (void*)(e & (~1));
12436 e_conv.is_owned = (e & 1) || (e == 0);
12437 e_conv = DecodeError_clone(&e_conv);
12438 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12439 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12440 return (uint64_t)ret_conv;
12443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12444 if ((_res & 1) != 0) return;
12445 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12447 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12451 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12452 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12453 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12454 return (uint64_t)ret_conv;
12457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12458 LDKAnnouncementSignatures o_conv;
12459 o_conv.inner = (void*)(o & (~1));
12460 o_conv.is_owned = (o & 1) || (o == 0);
12461 o_conv = AnnouncementSignatures_clone(&o_conv);
12462 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12463 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12464 return (uint64_t)ret_conv;
12467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12468 LDKDecodeError e_conv;
12469 e_conv.inner = (void*)(e & (~1));
12470 e_conv.is_owned = (e & 1) || (e == 0);
12471 e_conv = DecodeError_clone(&e_conv);
12472 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12473 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12474 return (uint64_t)ret_conv;
12477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12478 if ((_res & 1) != 0) return;
12479 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12481 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12485 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12486 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12487 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12488 return (uint64_t)ret_conv;
12491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12492 LDKChannelReestablish o_conv;
12493 o_conv.inner = (void*)(o & (~1));
12494 o_conv.is_owned = (o & 1) || (o == 0);
12495 o_conv = ChannelReestablish_clone(&o_conv);
12496 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12497 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12498 return (uint64_t)ret_conv;
12501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12502 LDKDecodeError e_conv;
12503 e_conv.inner = (void*)(e & (~1));
12504 e_conv.is_owned = (e & 1) || (e == 0);
12505 e_conv = DecodeError_clone(&e_conv);
12506 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12507 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12508 return (uint64_t)ret_conv;
12511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12512 if ((_res & 1) != 0) return;
12513 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
12515 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12519 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12520 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12521 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12522 return (uint64_t)ret_conv;
12525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12526 LDKClosingSigned o_conv;
12527 o_conv.inner = (void*)(o & (~1));
12528 o_conv.is_owned = (o & 1) || (o == 0);
12529 o_conv = ClosingSigned_clone(&o_conv);
12530 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12531 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12532 return (uint64_t)ret_conv;
12535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12536 LDKDecodeError e_conv;
12537 e_conv.inner = (void*)(e & (~1));
12538 e_conv.is_owned = (e & 1) || (e == 0);
12539 e_conv = DecodeError_clone(&e_conv);
12540 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12541 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12542 return (uint64_t)ret_conv;
12545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12546 if ((_res & 1) != 0) return;
12547 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12549 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12553 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12554 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12555 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12556 return (uint64_t)ret_conv;
12559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12560 LDKClosingSignedFeeRange o_conv;
12561 o_conv.inner = (void*)(o & (~1));
12562 o_conv.is_owned = (o & 1) || (o == 0);
12563 o_conv = ClosingSignedFeeRange_clone(&o_conv);
12564 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12565 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
12566 return (uint64_t)ret_conv;
12569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12570 LDKDecodeError e_conv;
12571 e_conv.inner = (void*)(e & (~1));
12572 e_conv.is_owned = (e & 1) || (e == 0);
12573 e_conv = DecodeError_clone(&e_conv);
12574 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12575 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
12576 return (uint64_t)ret_conv;
12579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12580 if ((_res & 1) != 0) return;
12581 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12583 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
12586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12587 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
12588 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12589 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
12590 return (uint64_t)ret_conv;
12593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12594 LDKCommitmentSigned o_conv;
12595 o_conv.inner = (void*)(o & (~1));
12596 o_conv.is_owned = (o & 1) || (o == 0);
12597 o_conv = CommitmentSigned_clone(&o_conv);
12598 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12599 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12600 return (uint64_t)ret_conv;
12603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12604 LDKDecodeError e_conv;
12605 e_conv.inner = (void*)(e & (~1));
12606 e_conv.is_owned = (e & 1) || (e == 0);
12607 e_conv = DecodeError_clone(&e_conv);
12608 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12609 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12610 return (uint64_t)ret_conv;
12613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12614 if ((_res & 1) != 0) return;
12615 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12617 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12621 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12622 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12623 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12624 return (uint64_t)ret_conv;
12627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12628 LDKFundingCreated o_conv;
12629 o_conv.inner = (void*)(o & (~1));
12630 o_conv.is_owned = (o & 1) || (o == 0);
12631 o_conv = FundingCreated_clone(&o_conv);
12632 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12633 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12634 return (uint64_t)ret_conv;
12637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12638 LDKDecodeError e_conv;
12639 e_conv.inner = (void*)(e & (~1));
12640 e_conv.is_owned = (e & 1) || (e == 0);
12641 e_conv = DecodeError_clone(&e_conv);
12642 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12643 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12644 return (uint64_t)ret_conv;
12647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12648 if ((_res & 1) != 0) return;
12649 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12651 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12655 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12656 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12657 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12658 return (uint64_t)ret_conv;
12661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12662 LDKFundingSigned o_conv;
12663 o_conv.inner = (void*)(o & (~1));
12664 o_conv.is_owned = (o & 1) || (o == 0);
12665 o_conv = FundingSigned_clone(&o_conv);
12666 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12667 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12668 return (uint64_t)ret_conv;
12671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12672 LDKDecodeError e_conv;
12673 e_conv.inner = (void*)(e & (~1));
12674 e_conv.is_owned = (e & 1) || (e == 0);
12675 e_conv = DecodeError_clone(&e_conv);
12676 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12677 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12678 return (uint64_t)ret_conv;
12681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12682 if ((_res & 1) != 0) return;
12683 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12685 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12689 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12690 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12691 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12692 return (uint64_t)ret_conv;
12695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12696 LDKFundingLocked o_conv;
12697 o_conv.inner = (void*)(o & (~1));
12698 o_conv.is_owned = (o & 1) || (o == 0);
12699 o_conv = FundingLocked_clone(&o_conv);
12700 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12701 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12702 return (uint64_t)ret_conv;
12705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12706 LDKDecodeError e_conv;
12707 e_conv.inner = (void*)(e & (~1));
12708 e_conv.is_owned = (e & 1) || (e == 0);
12709 e_conv = DecodeError_clone(&e_conv);
12710 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12711 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12712 return (uint64_t)ret_conv;
12715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12716 if ((_res & 1) != 0) return;
12717 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12719 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12723 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12724 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12725 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12726 return (uint64_t)ret_conv;
12729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12731 o_conv.inner = (void*)(o & (~1));
12732 o_conv.is_owned = (o & 1) || (o == 0);
12733 o_conv = Init_clone(&o_conv);
12734 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12735 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12736 return (uint64_t)ret_conv;
12739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12740 LDKDecodeError e_conv;
12741 e_conv.inner = (void*)(e & (~1));
12742 e_conv.is_owned = (e & 1) || (e == 0);
12743 e_conv = DecodeError_clone(&e_conv);
12744 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12745 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12746 return (uint64_t)ret_conv;
12749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12750 if ((_res & 1) != 0) return;
12751 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12753 CResult_InitDecodeErrorZ_free(_res_conv);
12756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12757 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12758 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12759 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12760 return (uint64_t)ret_conv;
12763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12764 LDKOpenChannel o_conv;
12765 o_conv.inner = (void*)(o & (~1));
12766 o_conv.is_owned = (o & 1) || (o == 0);
12767 o_conv = OpenChannel_clone(&o_conv);
12768 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12769 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12770 return (uint64_t)ret_conv;
12773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12774 LDKDecodeError e_conv;
12775 e_conv.inner = (void*)(e & (~1));
12776 e_conv.is_owned = (e & 1) || (e == 0);
12777 e_conv = DecodeError_clone(&e_conv);
12778 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12779 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12780 return (uint64_t)ret_conv;
12783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12784 if ((_res & 1) != 0) return;
12785 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12787 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12791 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12792 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12793 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12794 return (uint64_t)ret_conv;
12797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12798 LDKRevokeAndACK o_conv;
12799 o_conv.inner = (void*)(o & (~1));
12800 o_conv.is_owned = (o & 1) || (o == 0);
12801 o_conv = RevokeAndACK_clone(&o_conv);
12802 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12803 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12804 return (uint64_t)ret_conv;
12807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12808 LDKDecodeError e_conv;
12809 e_conv.inner = (void*)(e & (~1));
12810 e_conv.is_owned = (e & 1) || (e == 0);
12811 e_conv = DecodeError_clone(&e_conv);
12812 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12813 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12814 return (uint64_t)ret_conv;
12817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12818 if ((_res & 1) != 0) return;
12819 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12821 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12825 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12826 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12827 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12828 return (uint64_t)ret_conv;
12831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12832 LDKShutdown o_conv;
12833 o_conv.inner = (void*)(o & (~1));
12834 o_conv.is_owned = (o & 1) || (o == 0);
12835 o_conv = Shutdown_clone(&o_conv);
12836 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12837 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12838 return (uint64_t)ret_conv;
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12842 LDKDecodeError e_conv;
12843 e_conv.inner = (void*)(e & (~1));
12844 e_conv.is_owned = (e & 1) || (e == 0);
12845 e_conv = DecodeError_clone(&e_conv);
12846 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12847 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12848 return (uint64_t)ret_conv;
12851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12852 if ((_res & 1) != 0) return;
12853 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12855 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12859 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12860 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12861 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12862 return (uint64_t)ret_conv;
12865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12866 LDKUpdateFailHTLC o_conv;
12867 o_conv.inner = (void*)(o & (~1));
12868 o_conv.is_owned = (o & 1) || (o == 0);
12869 o_conv = UpdateFailHTLC_clone(&o_conv);
12870 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12871 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12872 return (uint64_t)ret_conv;
12875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12876 LDKDecodeError e_conv;
12877 e_conv.inner = (void*)(e & (~1));
12878 e_conv.is_owned = (e & 1) || (e == 0);
12879 e_conv = DecodeError_clone(&e_conv);
12880 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12881 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12882 return (uint64_t)ret_conv;
12885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12886 if ((_res & 1) != 0) return;
12887 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12889 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12893 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12894 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12895 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12896 return (uint64_t)ret_conv;
12899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12900 LDKUpdateFailMalformedHTLC o_conv;
12901 o_conv.inner = (void*)(o & (~1));
12902 o_conv.is_owned = (o & 1) || (o == 0);
12903 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12904 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12905 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12906 return (uint64_t)ret_conv;
12909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12910 LDKDecodeError e_conv;
12911 e_conv.inner = (void*)(e & (~1));
12912 e_conv.is_owned = (e & 1) || (e == 0);
12913 e_conv = DecodeError_clone(&e_conv);
12914 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12915 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12916 return (uint64_t)ret_conv;
12919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12920 if ((_res & 1) != 0) return;
12921 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12923 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12927 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12928 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12929 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12930 return (uint64_t)ret_conv;
12933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12934 LDKUpdateFee o_conv;
12935 o_conv.inner = (void*)(o & (~1));
12936 o_conv.is_owned = (o & 1) || (o == 0);
12937 o_conv = UpdateFee_clone(&o_conv);
12938 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12939 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12940 return (uint64_t)ret_conv;
12943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12944 LDKDecodeError e_conv;
12945 e_conv.inner = (void*)(e & (~1));
12946 e_conv.is_owned = (e & 1) || (e == 0);
12947 e_conv = DecodeError_clone(&e_conv);
12948 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12949 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12950 return (uint64_t)ret_conv;
12953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12954 if ((_res & 1) != 0) return;
12955 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12957 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12961 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12962 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12963 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12964 return (uint64_t)ret_conv;
12967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12968 LDKUpdateFulfillHTLC o_conv;
12969 o_conv.inner = (void*)(o & (~1));
12970 o_conv.is_owned = (o & 1) || (o == 0);
12971 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12972 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12973 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12974 return (uint64_t)ret_conv;
12977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12978 LDKDecodeError e_conv;
12979 e_conv.inner = (void*)(e & (~1));
12980 e_conv.is_owned = (e & 1) || (e == 0);
12981 e_conv = DecodeError_clone(&e_conv);
12982 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12983 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12984 return (uint64_t)ret_conv;
12987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12988 if ((_res & 1) != 0) return;
12989 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12991 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12995 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12996 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12997 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12998 return (uint64_t)ret_conv;
13001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13002 LDKUpdateAddHTLC o_conv;
13003 o_conv.inner = (void*)(o & (~1));
13004 o_conv.is_owned = (o & 1) || (o == 0);
13005 o_conv = UpdateAddHTLC_clone(&o_conv);
13006 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13007 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
13008 return (uint64_t)ret_conv;
13011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13012 LDKDecodeError e_conv;
13013 e_conv.inner = (void*)(e & (~1));
13014 e_conv.is_owned = (e & 1) || (e == 0);
13015 e_conv = DecodeError_clone(&e_conv);
13016 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13017 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
13018 return (uint64_t)ret_conv;
13021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13022 if ((_res & 1) != 0) return;
13023 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
13025 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13029 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
13030 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13031 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
13032 return (uint64_t)ret_conv;
13035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13037 o_conv.inner = (void*)(o & (~1));
13038 o_conv.is_owned = (o & 1) || (o == 0);
13039 o_conv = Ping_clone(&o_conv);
13040 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13041 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
13042 return (uint64_t)ret_conv;
13045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13046 LDKDecodeError e_conv;
13047 e_conv.inner = (void*)(e & (~1));
13048 e_conv.is_owned = (e & 1) || (e == 0);
13049 e_conv = DecodeError_clone(&e_conv);
13050 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13051 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
13052 return (uint64_t)ret_conv;
13055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13056 if ((_res & 1) != 0) return;
13057 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
13059 CResult_PingDecodeErrorZ_free(_res_conv);
13062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13063 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
13064 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13065 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
13066 return (uint64_t)ret_conv;
13069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13071 o_conv.inner = (void*)(o & (~1));
13072 o_conv.is_owned = (o & 1) || (o == 0);
13073 o_conv = Pong_clone(&o_conv);
13074 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13075 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
13076 return (uint64_t)ret_conv;
13079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13080 LDKDecodeError e_conv;
13081 e_conv.inner = (void*)(e & (~1));
13082 e_conv.is_owned = (e & 1) || (e == 0);
13083 e_conv = DecodeError_clone(&e_conv);
13084 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13085 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
13086 return (uint64_t)ret_conv;
13089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13090 if ((_res & 1) != 0) return;
13091 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
13093 CResult_PongDecodeErrorZ_free(_res_conv);
13096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13097 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13098 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13099 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13100 return (uint64_t)ret_conv;
13103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13104 LDKUnsignedChannelAnnouncement o_conv;
13105 o_conv.inner = (void*)(o & (~1));
13106 o_conv.is_owned = (o & 1) || (o == 0);
13107 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13108 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13109 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13110 return (uint64_t)ret_conv;
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13114 LDKDecodeError e_conv;
13115 e_conv.inner = (void*)(e & (~1));
13116 e_conv.is_owned = (e & 1) || (e == 0);
13117 e_conv = DecodeError_clone(&e_conv);
13118 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13119 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13120 return (uint64_t)ret_conv;
13123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13124 if ((_res & 1) != 0) return;
13125 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13127 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13131 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13132 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13133 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13134 return (uint64_t)ret_conv;
13137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13138 LDKChannelAnnouncement o_conv;
13139 o_conv.inner = (void*)(o & (~1));
13140 o_conv.is_owned = (o & 1) || (o == 0);
13141 o_conv = ChannelAnnouncement_clone(&o_conv);
13142 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13143 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13144 return (uint64_t)ret_conv;
13147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13148 LDKDecodeError e_conv;
13149 e_conv.inner = (void*)(e & (~1));
13150 e_conv.is_owned = (e & 1) || (e == 0);
13151 e_conv = DecodeError_clone(&e_conv);
13152 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13153 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
13154 return (uint64_t)ret_conv;
13157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13158 if ((_res & 1) != 0) return;
13159 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13161 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
13164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13165 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13166 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13167 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13168 return (uint64_t)ret_conv;
13171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13172 LDKUnsignedChannelUpdate o_conv;
13173 o_conv.inner = (void*)(o & (~1));
13174 o_conv.is_owned = (o & 1) || (o == 0);
13175 o_conv = UnsignedChannelUpdate_clone(&o_conv);
13176 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13177 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
13178 return (uint64_t)ret_conv;
13181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13182 LDKDecodeError e_conv;
13183 e_conv.inner = (void*)(e & (~1));
13184 e_conv.is_owned = (e & 1) || (e == 0);
13185 e_conv = DecodeError_clone(&e_conv);
13186 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13187 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
13188 return (uint64_t)ret_conv;
13191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13192 if ((_res & 1) != 0) return;
13193 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13195 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
13198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13199 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
13200 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13201 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
13202 return (uint64_t)ret_conv;
13205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13206 LDKChannelUpdate o_conv;
13207 o_conv.inner = (void*)(o & (~1));
13208 o_conv.is_owned = (o & 1) || (o == 0);
13209 o_conv = ChannelUpdate_clone(&o_conv);
13210 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13211 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
13212 return (uint64_t)ret_conv;
13215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13216 LDKDecodeError e_conv;
13217 e_conv.inner = (void*)(e & (~1));
13218 e_conv.is_owned = (e & 1) || (e == 0);
13219 e_conv = DecodeError_clone(&e_conv);
13220 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13221 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
13222 return (uint64_t)ret_conv;
13225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13226 if ((_res & 1) != 0) return;
13227 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13229 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
13232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13233 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
13234 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13235 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
13236 return (uint64_t)ret_conv;
13239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13240 LDKErrorMessage o_conv;
13241 o_conv.inner = (void*)(o & (~1));
13242 o_conv.is_owned = (o & 1) || (o == 0);
13243 o_conv = ErrorMessage_clone(&o_conv);
13244 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13245 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
13246 return (uint64_t)ret_conv;
13249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13250 LDKDecodeError e_conv;
13251 e_conv.inner = (void*)(e & (~1));
13252 e_conv.is_owned = (e & 1) || (e == 0);
13253 e_conv = DecodeError_clone(&e_conv);
13254 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13255 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
13256 return (uint64_t)ret_conv;
13259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13260 if ((_res & 1) != 0) return;
13261 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
13263 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
13266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13267 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
13268 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13269 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
13270 return (uint64_t)ret_conv;
13273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13274 LDKUnsignedNodeAnnouncement o_conv;
13275 o_conv.inner = (void*)(o & (~1));
13276 o_conv.is_owned = (o & 1) || (o == 0);
13277 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
13278 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13279 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
13280 return (uint64_t)ret_conv;
13283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13284 LDKDecodeError e_conv;
13285 e_conv.inner = (void*)(e & (~1));
13286 e_conv.is_owned = (e & 1) || (e == 0);
13287 e_conv = DecodeError_clone(&e_conv);
13288 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13289 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
13290 return (uint64_t)ret_conv;
13293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13294 if ((_res & 1) != 0) return;
13295 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13297 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
13300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13301 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
13302 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13303 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
13304 return (uint64_t)ret_conv;
13307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13308 LDKNodeAnnouncement o_conv;
13309 o_conv.inner = (void*)(o & (~1));
13310 o_conv.is_owned = (o & 1) || (o == 0);
13311 o_conv = NodeAnnouncement_clone(&o_conv);
13312 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13313 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
13314 return (uint64_t)ret_conv;
13317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13318 LDKDecodeError e_conv;
13319 e_conv.inner = (void*)(e & (~1));
13320 e_conv.is_owned = (e & 1) || (e == 0);
13321 e_conv = DecodeError_clone(&e_conv);
13322 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13323 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
13324 return (uint64_t)ret_conv;
13327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13328 if ((_res & 1) != 0) return;
13329 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13331 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
13334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13335 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
13336 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13337 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
13338 return (uint64_t)ret_conv;
13341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13342 LDKQueryShortChannelIds o_conv;
13343 o_conv.inner = (void*)(o & (~1));
13344 o_conv.is_owned = (o & 1) || (o == 0);
13345 o_conv = QueryShortChannelIds_clone(&o_conv);
13346 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13347 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
13348 return (uint64_t)ret_conv;
13351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13352 LDKDecodeError e_conv;
13353 e_conv.inner = (void*)(e & (~1));
13354 e_conv.is_owned = (e & 1) || (e == 0);
13355 e_conv = DecodeError_clone(&e_conv);
13356 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13357 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
13358 return (uint64_t)ret_conv;
13361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13362 if ((_res & 1) != 0) return;
13363 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
13365 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13369 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13370 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13371 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13372 return (uint64_t)ret_conv;
13375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13376 LDKReplyShortChannelIdsEnd o_conv;
13377 o_conv.inner = (void*)(o & (~1));
13378 o_conv.is_owned = (o & 1) || (o == 0);
13379 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13380 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13381 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13382 return (uint64_t)ret_conv;
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13386 LDKDecodeError e_conv;
13387 e_conv.inner = (void*)(e & (~1));
13388 e_conv.is_owned = (e & 1) || (e == 0);
13389 e_conv = DecodeError_clone(&e_conv);
13390 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13391 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13392 return (uint64_t)ret_conv;
13395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13396 if ((_res & 1) != 0) return;
13397 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
13399 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13403 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13404 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13405 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13406 return (uint64_t)ret_conv;
13409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13410 LDKQueryChannelRange o_conv;
13411 o_conv.inner = (void*)(o & (~1));
13412 o_conv.is_owned = (o & 1) || (o == 0);
13413 o_conv = QueryChannelRange_clone(&o_conv);
13414 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13415 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13416 return (uint64_t)ret_conv;
13419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13420 LDKDecodeError e_conv;
13421 e_conv.inner = (void*)(e & (~1));
13422 e_conv.is_owned = (e & 1) || (e == 0);
13423 e_conv = DecodeError_clone(&e_conv);
13424 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13425 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13426 return (uint64_t)ret_conv;
13429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13430 if ((_res & 1) != 0) return;
13431 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13433 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13437 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13438 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13439 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13440 return (uint64_t)ret_conv;
13443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13444 LDKReplyChannelRange o_conv;
13445 o_conv.inner = (void*)(o & (~1));
13446 o_conv.is_owned = (o & 1) || (o == 0);
13447 o_conv = ReplyChannelRange_clone(&o_conv);
13448 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13449 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13450 return (uint64_t)ret_conv;
13453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13454 LDKDecodeError e_conv;
13455 e_conv.inner = (void*)(e & (~1));
13456 e_conv.is_owned = (e & 1) || (e == 0);
13457 e_conv = DecodeError_clone(&e_conv);
13458 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13459 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13460 return (uint64_t)ret_conv;
13463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13464 if ((_res & 1) != 0) return;
13465 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13467 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13471 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13472 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13473 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13474 return (uint64_t)ret_conv;
13477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13478 LDKGossipTimestampFilter o_conv;
13479 o_conv.inner = (void*)(o & (~1));
13480 o_conv.is_owned = (o & 1) || (o == 0);
13481 o_conv = GossipTimestampFilter_clone(&o_conv);
13482 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13483 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13484 return (uint64_t)ret_conv;
13487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13488 LDKDecodeError e_conv;
13489 e_conv.inner = (void*)(e & (~1));
13490 e_conv.is_owned = (e & 1) || (e == 0);
13491 e_conv = DecodeError_clone(&e_conv);
13492 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13493 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13494 return (uint64_t)ret_conv;
13497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13498 if ((_res & 1) != 0) return;
13499 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
13501 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13505 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13506 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13507 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13508 return (uint64_t)ret_conv;
13511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13513 o_conv.inner = (void*)(o & (~1));
13514 o_conv.is_owned = (o & 1) || (o == 0);
13515 o_conv = Invoice_clone(&o_conv);
13516 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13517 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13518 return (uint64_t)ret_conv;
13521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13522 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
13523 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13524 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13525 return (uint64_t)ret_conv;
13528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13529 if ((_res & 1) != 0) return;
13530 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
13532 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13536 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13537 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13538 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13539 return (uint64_t)ret_conv;
13542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13543 if ((this_ptr & 1) != 0) return;
13544 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
13545 FREE((void*)this_ptr);
13546 PaymentPurpose_free(this_ptr_conv);
13549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13550 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
13551 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13552 *ret_copy = PaymentPurpose_clone(orig_conv);
13553 uint64_t ret_ref = (uint64_t)ret_copy;
13557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
13558 LDKThirtyTwoBytes payment_preimage_ref;
13559 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13560 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13561 LDKThirtyTwoBytes payment_secret_ref;
13562 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13563 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13564 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13565 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
13566 uint64_t ret_ref = (uint64_t)ret_copy;
13570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
13571 LDKThirtyTwoBytes a_ref;
13572 CHECK((*env)->GetArrayLength(env, a) == 32);
13573 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13574 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13575 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
13576 uint64_t ret_ref = (uint64_t)ret_copy;
13580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13581 if ((this_ptr & 1) != 0) return;
13582 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
13583 FREE((void*)this_ptr);
13584 Event_free(this_ptr_conv);
13587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13588 LDKEvent* orig_conv = (LDKEvent*)orig;
13589 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13590 *ret_copy = Event_clone(orig_conv);
13591 uint64_t ret_ref = (uint64_t)ret_copy;
13595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
13596 LDKThirtyTwoBytes temporary_channel_id_ref;
13597 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
13598 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
13599 LDKCVec_u8Z output_script_ref;
13600 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
13601 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
13602 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
13603 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13604 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
13605 uint64_t ret_ref = (uint64_t)ret_copy;
13609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
13610 LDKThirtyTwoBytes payment_hash_ref;
13611 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13612 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13613 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
13614 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13615 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
13616 uint64_t ret_ref = (uint64_t)ret_copy;
13620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
13621 LDKThirtyTwoBytes payment_preimage_ref;
13622 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13623 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13624 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13625 *ret_copy = Event_payment_sent(payment_preimage_ref);
13626 uint64_t ret_ref = (uint64_t)ret_copy;
13630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest) {
13631 LDKThirtyTwoBytes payment_hash_ref;
13632 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13633 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13634 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13635 *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
13636 uint64_t ret_ref = (uint64_t)ret_copy;
13640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
13641 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13642 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
13643 uint64_t ret_ref = (uint64_t)ret_copy;
13647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
13648 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
13649 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
13650 if (outputs_constr.datalen > 0)
13651 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13653 outputs_constr.data = NULL;
13654 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
13655 for (size_t b = 0; b < outputs_constr.datalen; b++) {
13656 int64_t outputs_conv_27 = outputs_vals[b];
13657 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
13658 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
13659 outputs_constr.data[b] = outputs_conv_27_conv;
13661 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
13662 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13663 *ret_copy = Event_spendable_outputs(outputs_constr);
13664 uint64_t ret_ref = (uint64_t)ret_copy;
13668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
13669 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
13670 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13671 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
13672 uint64_t ret_ref = (uint64_t)ret_copy;
13676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
13677 LDKEvent* obj_conv = (LDKEvent*)obj;
13678 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13679 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13680 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13681 CVec_u8Z_free(ret_var);
13685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13686 if ((this_ptr & 1) != 0) return;
13687 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
13688 FREE((void*)this_ptr);
13689 MessageSendEvent_free(this_ptr_conv);
13692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13693 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13694 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13695 *ret_copy = MessageSendEvent_clone(orig_conv);
13696 uint64_t ret_ref = (uint64_t)ret_copy;
13700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13701 LDKPublicKey node_id_ref;
13702 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13703 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13704 LDKAcceptChannel msg_conv;
13705 msg_conv.inner = (void*)(msg & (~1));
13706 msg_conv.is_owned = (msg & 1) || (msg == 0);
13707 msg_conv = AcceptChannel_clone(&msg_conv);
13708 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13709 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
13710 uint64_t ret_ref = (uint64_t)ret_copy;
13714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13715 LDKPublicKey node_id_ref;
13716 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13717 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13718 LDKOpenChannel msg_conv;
13719 msg_conv.inner = (void*)(msg & (~1));
13720 msg_conv.is_owned = (msg & 1) || (msg == 0);
13721 msg_conv = OpenChannel_clone(&msg_conv);
13722 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13723 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
13724 uint64_t ret_ref = (uint64_t)ret_copy;
13728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13729 LDKPublicKey node_id_ref;
13730 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13731 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13732 LDKFundingCreated msg_conv;
13733 msg_conv.inner = (void*)(msg & (~1));
13734 msg_conv.is_owned = (msg & 1) || (msg == 0);
13735 msg_conv = FundingCreated_clone(&msg_conv);
13736 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13737 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
13738 uint64_t ret_ref = (uint64_t)ret_copy;
13742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13743 LDKPublicKey node_id_ref;
13744 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13745 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13746 LDKFundingSigned msg_conv;
13747 msg_conv.inner = (void*)(msg & (~1));
13748 msg_conv.is_owned = (msg & 1) || (msg == 0);
13749 msg_conv = FundingSigned_clone(&msg_conv);
13750 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13751 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
13752 uint64_t ret_ref = (uint64_t)ret_copy;
13756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13757 LDKPublicKey node_id_ref;
13758 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13759 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13760 LDKFundingLocked msg_conv;
13761 msg_conv.inner = (void*)(msg & (~1));
13762 msg_conv.is_owned = (msg & 1) || (msg == 0);
13763 msg_conv = FundingLocked_clone(&msg_conv);
13764 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13765 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
13766 uint64_t ret_ref = (uint64_t)ret_copy;
13770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13771 LDKPublicKey node_id_ref;
13772 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13773 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13774 LDKAnnouncementSignatures msg_conv;
13775 msg_conv.inner = (void*)(msg & (~1));
13776 msg_conv.is_owned = (msg & 1) || (msg == 0);
13777 msg_conv = AnnouncementSignatures_clone(&msg_conv);
13778 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13779 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
13780 uint64_t ret_ref = (uint64_t)ret_copy;
13784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
13785 LDKPublicKey node_id_ref;
13786 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13787 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13788 LDKCommitmentUpdate updates_conv;
13789 updates_conv.inner = (void*)(updates & (~1));
13790 updates_conv.is_owned = (updates & 1) || (updates == 0);
13791 updates_conv = CommitmentUpdate_clone(&updates_conv);
13792 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13793 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
13794 uint64_t ret_ref = (uint64_t)ret_copy;
13798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13799 LDKPublicKey node_id_ref;
13800 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13801 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13802 LDKRevokeAndACK msg_conv;
13803 msg_conv.inner = (void*)(msg & (~1));
13804 msg_conv.is_owned = (msg & 1) || (msg == 0);
13805 msg_conv = RevokeAndACK_clone(&msg_conv);
13806 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13807 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
13808 uint64_t ret_ref = (uint64_t)ret_copy;
13812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13813 LDKPublicKey node_id_ref;
13814 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13815 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13816 LDKClosingSigned msg_conv;
13817 msg_conv.inner = (void*)(msg & (~1));
13818 msg_conv.is_owned = (msg & 1) || (msg == 0);
13819 msg_conv = ClosingSigned_clone(&msg_conv);
13820 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13821 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
13822 uint64_t ret_ref = (uint64_t)ret_copy;
13826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13827 LDKPublicKey node_id_ref;
13828 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13829 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13830 LDKShutdown msg_conv;
13831 msg_conv.inner = (void*)(msg & (~1));
13832 msg_conv.is_owned = (msg & 1) || (msg == 0);
13833 msg_conv = Shutdown_clone(&msg_conv);
13834 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13835 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
13836 uint64_t ret_ref = (uint64_t)ret_copy;
13840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13841 LDKPublicKey node_id_ref;
13842 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13843 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13844 LDKChannelReestablish msg_conv;
13845 msg_conv.inner = (void*)(msg & (~1));
13846 msg_conv.is_owned = (msg & 1) || (msg == 0);
13847 msg_conv = ChannelReestablish_clone(&msg_conv);
13848 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13849 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
13850 uint64_t ret_ref = (uint64_t)ret_copy;
13854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
13855 LDKChannelAnnouncement msg_conv;
13856 msg_conv.inner = (void*)(msg & (~1));
13857 msg_conv.is_owned = (msg & 1) || (msg == 0);
13858 msg_conv = ChannelAnnouncement_clone(&msg_conv);
13859 LDKChannelUpdate update_msg_conv;
13860 update_msg_conv.inner = (void*)(update_msg & (~1));
13861 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
13862 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
13863 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13864 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
13865 uint64_t ret_ref = (uint64_t)ret_copy;
13869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
13870 LDKNodeAnnouncement msg_conv;
13871 msg_conv.inner = (void*)(msg & (~1));
13872 msg_conv.is_owned = (msg & 1) || (msg == 0);
13873 msg_conv = NodeAnnouncement_clone(&msg_conv);
13874 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13875 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
13876 uint64_t ret_ref = (uint64_t)ret_copy;
13880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
13881 LDKChannelUpdate msg_conv;
13882 msg_conv.inner = (void*)(msg & (~1));
13883 msg_conv.is_owned = (msg & 1) || (msg == 0);
13884 msg_conv = ChannelUpdate_clone(&msg_conv);
13885 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13886 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
13887 uint64_t ret_ref = (uint64_t)ret_copy;
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13892 LDKPublicKey node_id_ref;
13893 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13894 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13895 LDKChannelUpdate msg_conv;
13896 msg_conv.inner = (void*)(msg & (~1));
13897 msg_conv.is_owned = (msg & 1) || (msg == 0);
13898 msg_conv = ChannelUpdate_clone(&msg_conv);
13899 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13900 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
13901 uint64_t ret_ref = (uint64_t)ret_copy;
13905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
13906 LDKPublicKey node_id_ref;
13907 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13908 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13909 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
13910 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13911 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
13912 uint64_t ret_ref = (uint64_t)ret_copy;
13916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update(JNIEnv *env, jclass clz, int64_t update) {
13917 LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
13918 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13919 *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
13920 uint64_t ret_ref = (uint64_t)ret_copy;
13924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13925 LDKPublicKey node_id_ref;
13926 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13927 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13928 LDKQueryChannelRange msg_conv;
13929 msg_conv.inner = (void*)(msg & (~1));
13930 msg_conv.is_owned = (msg & 1) || (msg == 0);
13931 msg_conv = QueryChannelRange_clone(&msg_conv);
13932 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13933 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
13934 uint64_t ret_ref = (uint64_t)ret_copy;
13938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13939 LDKPublicKey node_id_ref;
13940 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13941 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13942 LDKQueryShortChannelIds msg_conv;
13943 msg_conv.inner = (void*)(msg & (~1));
13944 msg_conv.is_owned = (msg & 1) || (msg == 0);
13945 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13946 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13947 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
13948 uint64_t ret_ref = (uint64_t)ret_copy;
13952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13953 LDKPublicKey node_id_ref;
13954 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13955 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13956 LDKReplyChannelRange msg_conv;
13957 msg_conv.inner = (void*)(msg & (~1));
13958 msg_conv.is_owned = (msg & 1) || (msg == 0);
13959 msg_conv = ReplyChannelRange_clone(&msg_conv);
13960 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13961 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
13962 uint64_t ret_ref = (uint64_t)ret_copy;
13966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13967 if ((this_ptr & 1) != 0) return;
13968 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
13969 FREE((void*)this_ptr);
13970 MessageSendEventsProvider_free(this_ptr_conv);
13973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13974 if ((this_ptr & 1) != 0) return;
13975 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
13976 FREE((void*)this_ptr);
13977 EventsProvider_free(this_ptr_conv);
13980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13981 if ((this_ptr & 1) != 0) return;
13982 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
13983 FREE((void*)this_ptr);
13984 EventHandler_free(this_ptr_conv);
13987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13988 if ((this_ptr & 1) != 0) return;
13989 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
13990 FREE((void*)this_ptr);
13991 APIError_free(this_ptr_conv);
13994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13995 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13996 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13997 *ret_copy = APIError_clone(orig_conv);
13998 uint64_t ret_ref = (uint64_t)ret_copy;
14002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
14003 LDKStr err_conv = java_to_owned_str(env, err);
14004 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14005 *ret_copy = APIError_apimisuse_error(err_conv);
14006 uint64_t ret_ref = (uint64_t)ret_copy;
14010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
14011 LDKStr err_conv = java_to_owned_str(env, err);
14012 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14013 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
14014 uint64_t ret_ref = (uint64_t)ret_copy;
14018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
14019 LDKStr err_conv = java_to_owned_str(env, err);
14020 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14021 *ret_copy = APIError_route_error(err_conv);
14022 uint64_t ret_ref = (uint64_t)ret_copy;
14026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
14027 LDKStr err_conv = java_to_owned_str(env, err);
14028 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14029 *ret_copy = APIError_channel_unavailable(err_conv);
14030 uint64_t ret_ref = (uint64_t)ret_copy;
14034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
14035 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14036 *ret_copy = APIError_monitor_update_failed();
14037 uint64_t ret_ref = (uint64_t)ret_copy;
14041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
14042 LDKShutdownScript script_conv;
14043 script_conv.inner = (void*)(script & (~1));
14044 script_conv.is_owned = (script & 1) || (script == 0);
14045 script_conv = ShutdownScript_clone(&script_conv);
14046 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14047 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
14048 uint64_t ret_ref = (uint64_t)ret_copy;
14052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
14053 LDKu8slice msg_ref;
14054 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14055 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14056 unsigned char sk_arr[32];
14057 CHECK((*env)->GetArrayLength(env, sk) == 32);
14058 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
14059 unsigned char (*sk_ref)[32] = &sk_arr;
14060 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
14061 *ret_conv = sign(msg_ref, sk_ref);
14062 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14063 return (uint64_t)ret_conv;
14066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
14067 LDKu8slice msg_ref;
14068 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14069 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14070 LDKStr sig_conv = java_to_owned_str(env, sig);
14071 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14072 *ret_conv = recover_pk(msg_ref, sig_conv);
14073 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14074 return (uint64_t)ret_conv;
14077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
14078 LDKu8slice msg_ref;
14079 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14080 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14081 LDKStr sig_conv = java_to_owned_str(env, sig);
14082 LDKPublicKey pk_ref;
14083 CHECK((*env)->GetArrayLength(env, pk) == 33);
14084 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
14085 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
14086 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14091 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
14092 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
14096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
14097 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
14101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
14102 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
14106 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
14107 jclass ret_conv = LDKLevel_to_java(env, Level_info());
14111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
14112 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
14116 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
14117 jclass ret_conv = LDKLevel_to_java(env, Level_error());
14121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14122 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
14123 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
14124 jboolean ret_val = Level_eq(a_conv, b_conv);
14128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
14129 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
14130 int64_t ret_val = Level_hash(o_conv);
14134 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
14135 jclass ret_conv = LDKLevel_to_java(env, Level_max());
14139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14140 if ((this_ptr & 1) != 0) return;
14141 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
14142 FREE((void*)this_ptr);
14143 Logger_free(this_ptr_conv);
14146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14147 LDKChannelHandshakeConfig this_obj_conv;
14148 this_obj_conv.inner = (void*)(this_obj & (~1));
14149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14150 ChannelHandshakeConfig_free(this_obj_conv);
14153 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
14154 LDKChannelHandshakeConfig this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = false;
14157 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14162 LDKChannelHandshakeConfig this_ptr_conv;
14163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14164 this_ptr_conv.is_owned = false;
14165 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
14168 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14169 LDKChannelHandshakeConfig this_ptr_conv;
14170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14171 this_ptr_conv.is_owned = false;
14172 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
14176 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) {
14177 LDKChannelHandshakeConfig this_ptr_conv;
14178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14179 this_ptr_conv.is_owned = false;
14180 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
14183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14184 LDKChannelHandshakeConfig this_ptr_conv;
14185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14186 this_ptr_conv.is_owned = false;
14187 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
14191 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) {
14192 LDKChannelHandshakeConfig this_ptr_conv;
14193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14194 this_ptr_conv.is_owned = false;
14195 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
14198 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) {
14199 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
14200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14202 uint64_t ret_ref = (uint64_t)ret_var.inner;
14203 if (ret_var.is_owned) {
14209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14210 LDKChannelHandshakeConfig orig_conv;
14211 orig_conv.inner = (void*)(orig & (~1));
14212 orig_conv.is_owned = false;
14213 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
14214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14216 uint64_t ret_ref = (uint64_t)ret_var.inner;
14217 if (ret_var.is_owned) {
14223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
14224 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
14225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14227 uint64_t ret_ref = (uint64_t)ret_var.inner;
14228 if (ret_var.is_owned) {
14234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14235 LDKChannelHandshakeLimits this_obj_conv;
14236 this_obj_conv.inner = (void*)(this_obj & (~1));
14237 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14238 ChannelHandshakeLimits_free(this_obj_conv);
14241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14242 LDKChannelHandshakeLimits this_ptr_conv;
14243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14244 this_ptr_conv.is_owned = false;
14245 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
14249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14250 LDKChannelHandshakeLimits this_ptr_conv;
14251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14252 this_ptr_conv.is_owned = false;
14253 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
14256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14257 LDKChannelHandshakeLimits this_ptr_conv;
14258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14259 this_ptr_conv.is_owned = false;
14260 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
14264 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) {
14265 LDKChannelHandshakeLimits this_ptr_conv;
14266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14267 this_ptr_conv.is_owned = false;
14268 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
14271 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) {
14272 LDKChannelHandshakeLimits this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = false;
14275 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
14279 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) {
14280 LDKChannelHandshakeLimits this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
14286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14287 LDKChannelHandshakeLimits this_ptr_conv;
14288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14289 this_ptr_conv.is_owned = false;
14290 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
14294 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) {
14295 LDKChannelHandshakeLimits this_ptr_conv;
14296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14297 this_ptr_conv.is_owned = false;
14298 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
14301 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
14302 LDKChannelHandshakeLimits this_ptr_conv;
14303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14304 this_ptr_conv.is_owned = false;
14305 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
14309 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) {
14310 LDKChannelHandshakeLimits this_ptr_conv;
14311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14312 this_ptr_conv.is_owned = false;
14313 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
14316 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
14317 LDKChannelHandshakeLimits this_ptr_conv;
14318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14319 this_ptr_conv.is_owned = false;
14320 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
14324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14325 LDKChannelHandshakeLimits this_ptr_conv;
14326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14327 this_ptr_conv.is_owned = false;
14328 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
14331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
14332 LDKChannelHandshakeLimits this_ptr_conv;
14333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14334 this_ptr_conv.is_owned = false;
14335 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
14339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14340 LDKChannelHandshakeLimits this_ptr_conv;
14341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14342 this_ptr_conv.is_owned = false;
14343 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
14346 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14347 LDKChannelHandshakeLimits this_ptr_conv;
14348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14349 this_ptr_conv.is_owned = false;
14350 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
14354 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) {
14355 LDKChannelHandshakeLimits this_ptr_conv;
14356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14357 this_ptr_conv.is_owned = false;
14358 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
14361 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) {
14362 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);
14363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14365 uint64_t ret_ref = (uint64_t)ret_var.inner;
14366 if (ret_var.is_owned) {
14372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14373 LDKChannelHandshakeLimits orig_conv;
14374 orig_conv.inner = (void*)(orig & (~1));
14375 orig_conv.is_owned = false;
14376 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
14377 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14378 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14379 uint64_t ret_ref = (uint64_t)ret_var.inner;
14380 if (ret_var.is_owned) {
14386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
14387 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
14388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14390 uint64_t ret_ref = (uint64_t)ret_var.inner;
14391 if (ret_var.is_owned) {
14397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14398 LDKChannelConfig this_obj_conv;
14399 this_obj_conv.inner = (void*)(this_obj & (~1));
14400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14401 ChannelConfig_free(this_obj_conv);
14404 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
14405 LDKChannelConfig this_ptr_conv;
14406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14407 this_ptr_conv.is_owned = false;
14408 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
14412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14413 LDKChannelConfig this_ptr_conv;
14414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14415 this_ptr_conv.is_owned = false;
14416 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
14419 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14420 LDKChannelConfig this_ptr_conv;
14421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14422 this_ptr_conv.is_owned = false;
14423 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
14427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14428 LDKChannelConfig this_ptr_conv;
14429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14430 this_ptr_conv.is_owned = false;
14431 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
14434 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
14435 LDKChannelConfig this_ptr_conv;
14436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14437 this_ptr_conv.is_owned = false;
14438 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
14442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14443 LDKChannelConfig this_ptr_conv;
14444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14445 this_ptr_conv.is_owned = false;
14446 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
14449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
14450 LDKChannelConfig this_ptr_conv;
14451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14452 this_ptr_conv.is_owned = false;
14453 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
14457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14458 LDKChannelConfig this_ptr_conv;
14459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14460 this_ptr_conv.is_owned = false;
14461 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
14464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14465 LDKChannelConfig this_ptr_conv;
14466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14467 this_ptr_conv.is_owned = false;
14468 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
14472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14473 LDKChannelConfig this_ptr_conv;
14474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14475 this_ptr_conv.is_owned = false;
14476 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
14479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14480 LDKChannelConfig this_ptr_conv;
14481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14482 this_ptr_conv.is_owned = false;
14483 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
14487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14488 LDKChannelConfig this_ptr_conv;
14489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14490 this_ptr_conv.is_owned = false;
14491 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
14494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14495 LDKChannelConfig this_ptr_conv;
14496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14497 this_ptr_conv.is_owned = false;
14498 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
14502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14503 LDKChannelConfig this_ptr_conv;
14504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14505 this_ptr_conv.is_owned = false;
14506 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
14509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
14510 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
14511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14513 uint64_t ret_ref = (uint64_t)ret_var.inner;
14514 if (ret_var.is_owned) {
14520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14521 LDKChannelConfig orig_conv;
14522 orig_conv.inner = (void*)(orig & (~1));
14523 orig_conv.is_owned = false;
14524 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
14525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14527 uint64_t ret_ref = (uint64_t)ret_var.inner;
14528 if (ret_var.is_owned) {
14534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
14535 LDKChannelConfig ret_var = ChannelConfig_default();
14536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14538 uint64_t ret_ref = (uint64_t)ret_var.inner;
14539 if (ret_var.is_owned) {
14545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
14546 LDKChannelConfig obj_conv;
14547 obj_conv.inner = (void*)(obj & (~1));
14548 obj_conv.is_owned = false;
14549 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
14550 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14551 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14552 CVec_u8Z_free(ret_var);
14556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14557 LDKu8slice ser_ref;
14558 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14559 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14560 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14561 *ret_conv = ChannelConfig_read(ser_ref);
14562 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14563 return (uint64_t)ret_conv;
14566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14567 LDKUserConfig this_obj_conv;
14568 this_obj_conv.inner = (void*)(this_obj & (~1));
14569 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14570 UserConfig_free(this_obj_conv);
14573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
14574 LDKUserConfig this_ptr_conv;
14575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14576 this_ptr_conv.is_owned = false;
14577 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
14578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14580 uint64_t ret_ref = (uint64_t)ret_var.inner;
14581 if (ret_var.is_owned) {
14587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14588 LDKUserConfig this_ptr_conv;
14589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14590 this_ptr_conv.is_owned = false;
14591 LDKChannelHandshakeConfig val_conv;
14592 val_conv.inner = (void*)(val & (~1));
14593 val_conv.is_owned = (val & 1) || (val == 0);
14594 val_conv = ChannelHandshakeConfig_clone(&val_conv);
14595 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
14598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
14599 LDKUserConfig this_ptr_conv;
14600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14601 this_ptr_conv.is_owned = false;
14602 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
14603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14605 uint64_t ret_ref = (uint64_t)ret_var.inner;
14606 if (ret_var.is_owned) {
14612 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) {
14613 LDKUserConfig this_ptr_conv;
14614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14615 this_ptr_conv.is_owned = false;
14616 LDKChannelHandshakeLimits val_conv;
14617 val_conv.inner = (void*)(val & (~1));
14618 val_conv.is_owned = (val & 1) || (val == 0);
14619 val_conv = ChannelHandshakeLimits_clone(&val_conv);
14620 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
14623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
14624 LDKUserConfig this_ptr_conv;
14625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14626 this_ptr_conv.is_owned = false;
14627 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
14628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14630 uint64_t ret_ref = (uint64_t)ret_var.inner;
14631 if (ret_var.is_owned) {
14637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14638 LDKUserConfig this_ptr_conv;
14639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14640 this_ptr_conv.is_owned = false;
14641 LDKChannelConfig val_conv;
14642 val_conv.inner = (void*)(val & (~1));
14643 val_conv.is_owned = (val & 1) || (val == 0);
14644 val_conv = ChannelConfig_clone(&val_conv);
14645 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
14648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
14649 LDKUserConfig this_ptr_conv;
14650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14651 this_ptr_conv.is_owned = false;
14652 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
14656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14657 LDKUserConfig this_ptr_conv;
14658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14659 this_ptr_conv.is_owned = false;
14660 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
14663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) {
14664 LDKChannelHandshakeConfig own_channel_config_arg_conv;
14665 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
14666 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
14667 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
14668 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
14669 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
14670 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
14671 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
14672 LDKChannelConfig channel_options_arg_conv;
14673 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
14674 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
14675 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
14676 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg);
14677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14679 uint64_t ret_ref = (uint64_t)ret_var.inner;
14680 if (ret_var.is_owned) {
14686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14687 LDKUserConfig orig_conv;
14688 orig_conv.inner = (void*)(orig & (~1));
14689 orig_conv.is_owned = false;
14690 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
14691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14693 uint64_t ret_ref = (uint64_t)ret_var.inner;
14694 if (ret_var.is_owned) {
14700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
14701 LDKUserConfig ret_var = UserConfig_default();
14702 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14703 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14704 uint64_t ret_ref = (uint64_t)ret_var.inner;
14705 if (ret_var.is_owned) {
14711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14712 LDKBestBlock 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 BestBlock_free(this_obj_conv);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14719 LDKBestBlock orig_conv;
14720 orig_conv.inner = (void*)(orig & (~1));
14721 orig_conv.is_owned = false;
14722 LDKBestBlock ret_var = BestBlock_clone(&orig_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 int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
14733 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
14734 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
14735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14737 uint64_t ret_ref = (uint64_t)ret_var.inner;
14738 if (ret_var.is_owned) {
14744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
14745 LDKThirtyTwoBytes block_hash_ref;
14746 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
14747 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
14748 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
14749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14751 uint64_t ret_ref = (uint64_t)ret_var.inner;
14752 if (ret_var.is_owned) {
14758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14759 LDKBestBlock this_arg_conv;
14760 this_arg_conv.inner = (void*)(this_arg & (~1));
14761 this_arg_conv.is_owned = false;
14762 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14763 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
14767 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
14768 LDKBestBlock this_arg_conv;
14769 this_arg_conv.inner = (void*)(this_arg & (~1));
14770 this_arg_conv.is_owned = false;
14771 int32_t ret_val = BestBlock_height(&this_arg_conv);
14775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14776 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
14777 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
14781 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
14782 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
14786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
14787 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
14791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14792 if ((this_ptr & 1) != 0) return;
14793 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
14794 FREE((void*)this_ptr);
14795 Access_free(this_ptr_conv);
14798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14799 if ((this_ptr & 1) != 0) return;
14800 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
14801 FREE((void*)this_ptr);
14802 Listen_free(this_ptr_conv);
14805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14806 if ((this_ptr & 1) != 0) return;
14807 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
14808 FREE((void*)this_ptr);
14809 Confirm_free(this_ptr_conv);
14812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14813 if ((this_ptr & 1) != 0) return;
14814 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
14815 FREE((void*)this_ptr);
14816 Watch_free(this_ptr_conv);
14819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14820 if ((this_ptr & 1) != 0) return;
14821 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
14822 FREE((void*)this_ptr);
14823 Filter_free(this_ptr_conv);
14826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14827 LDKWatchedOutput this_obj_conv;
14828 this_obj_conv.inner = (void*)(this_obj & (~1));
14829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14830 WatchedOutput_free(this_obj_conv);
14833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14834 LDKWatchedOutput this_ptr_conv;
14835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14836 this_ptr_conv.is_owned = false;
14837 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
14842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14843 LDKWatchedOutput this_ptr_conv;
14844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14845 this_ptr_conv.is_owned = false;
14846 LDKThirtyTwoBytes val_ref;
14847 CHECK((*env)->GetArrayLength(env, val) == 32);
14848 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14849 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
14852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14853 LDKWatchedOutput this_ptr_conv;
14854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14855 this_ptr_conv.is_owned = false;
14856 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
14857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14859 uint64_t ret_ref = (uint64_t)ret_var.inner;
14860 if (ret_var.is_owned) {
14866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14867 LDKWatchedOutput this_ptr_conv;
14868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14869 this_ptr_conv.is_owned = false;
14870 LDKOutPoint val_conv;
14871 val_conv.inner = (void*)(val & (~1));
14872 val_conv.is_owned = (val & 1) || (val == 0);
14873 val_conv = OutPoint_clone(&val_conv);
14874 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
14877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14878 LDKWatchedOutput this_ptr_conv;
14879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14880 this_ptr_conv.is_owned = false;
14881 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_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);
14887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14888 LDKWatchedOutput this_ptr_conv;
14889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14890 this_ptr_conv.is_owned = false;
14891 LDKCVec_u8Z val_ref;
14892 val_ref.datalen = (*env)->GetArrayLength(env, val);
14893 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14894 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
14895 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
14898 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) {
14899 LDKThirtyTwoBytes block_hash_arg_ref;
14900 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
14901 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
14902 LDKOutPoint outpoint_arg_conv;
14903 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14904 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14905 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14906 LDKCVec_u8Z script_pubkey_arg_ref;
14907 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
14908 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14909 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
14910 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
14911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14913 uint64_t ret_ref = (uint64_t)ret_var.inner;
14914 if (ret_var.is_owned) {
14920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14921 LDKWatchedOutput orig_conv;
14922 orig_conv.inner = (void*)(orig & (~1));
14923 orig_conv.is_owned = false;
14924 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
14925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14927 uint64_t ret_ref = (uint64_t)ret_var.inner;
14928 if (ret_var.is_owned) {
14934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
14935 LDKWatchedOutput o_conv;
14936 o_conv.inner = (void*)(o & (~1));
14937 o_conv.is_owned = false;
14938 int64_t ret_val = WatchedOutput_hash(&o_conv);
14942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14943 if ((this_ptr & 1) != 0) return;
14944 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
14945 FREE((void*)this_ptr);
14946 BroadcasterInterface_free(this_ptr_conv);
14949 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14950 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
14951 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
14955 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
14956 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
14960 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
14961 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
14965 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
14966 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
14970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14971 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
14972 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
14973 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
14977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14978 if ((this_ptr & 1) != 0) return;
14979 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
14980 FREE((void*)this_ptr);
14981 FeeEstimator_free(this_ptr_conv);
14984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14985 LDKChainMonitor this_obj_conv;
14986 this_obj_conv.inner = (void*)(this_obj & (~1));
14987 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14988 ChainMonitor_free(this_obj_conv);
14991 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) {
14992 LDKFilter *chain_source_conv_ptr = NULL;
14993 if (chain_source != 0) {
14994 LDKFilter chain_source_conv;
14995 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
14996 if (chain_source_conv.free == LDKFilter_JCalls_free) {
14997 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14998 LDKFilter_JCalls_cloned(&chain_source_conv);
15000 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
15001 *chain_source_conv_ptr = chain_source_conv;
15003 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15004 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15005 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15006 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15008 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15009 if (logger_conv.free == LDKLogger_JCalls_free) {
15010 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15011 LDKLogger_JCalls_cloned(&logger_conv);
15013 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
15014 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
15015 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15016 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
15018 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
15019 if (persister_conv.free == LDKPersist_JCalls_free) {
15020 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15021 LDKPersist_JCalls_cloned(&persister_conv);
15023 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
15024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15026 uint64_t ret_ref = (uint64_t)ret_var.inner;
15027 if (ret_var.is_owned) {
15033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15034 LDKChainMonitor this_arg_conv;
15035 this_arg_conv.inner = (void*)(this_arg & (~1));
15036 this_arg_conv.is_owned = false;
15037 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15038 *ret = ChainMonitor_as_Listen(&this_arg_conv);
15039 return (uint64_t)ret;
15042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15043 LDKChainMonitor this_arg_conv;
15044 this_arg_conv.inner = (void*)(this_arg & (~1));
15045 this_arg_conv.is_owned = false;
15046 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15047 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
15048 return (uint64_t)ret;
15051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
15052 LDKChainMonitor this_arg_conv;
15053 this_arg_conv.inner = (void*)(this_arg & (~1));
15054 this_arg_conv.is_owned = false;
15055 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
15056 *ret = ChainMonitor_as_Watch(&this_arg_conv);
15057 return (uint64_t)ret;
15060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15061 LDKChainMonitor this_arg_conv;
15062 this_arg_conv.inner = (void*)(this_arg & (~1));
15063 this_arg_conv.is_owned = false;
15064 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15065 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
15066 return (uint64_t)ret;
15069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15070 LDKChannelMonitorUpdate this_obj_conv;
15071 this_obj_conv.inner = (void*)(this_obj & (~1));
15072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15073 ChannelMonitorUpdate_free(this_obj_conv);
15076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15077 LDKChannelMonitorUpdate this_ptr_conv;
15078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15079 this_ptr_conv.is_owned = false;
15080 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
15084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15085 LDKChannelMonitorUpdate this_ptr_conv;
15086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15087 this_ptr_conv.is_owned = false;
15088 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
15091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15092 LDKChannelMonitorUpdate orig_conv;
15093 orig_conv.inner = (void*)(orig & (~1));
15094 orig_conv.is_owned = false;
15095 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
15096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15098 uint64_t ret_ref = (uint64_t)ret_var.inner;
15099 if (ret_var.is_owned) {
15105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15106 LDKChannelMonitorUpdate obj_conv;
15107 obj_conv.inner = (void*)(obj & (~1));
15108 obj_conv.is_owned = false;
15109 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
15110 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15111 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15112 CVec_u8Z_free(ret_var);
15116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15117 LDKu8slice ser_ref;
15118 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15119 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15120 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15121 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
15122 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15123 return (uint64_t)ret_conv;
15126 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15127 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
15128 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
15132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
15133 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
15137 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
15138 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
15142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15143 LDKMonitorUpdateError this_obj_conv;
15144 this_obj_conv.inner = (void*)(this_obj & (~1));
15145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15146 MonitorUpdateError_free(this_obj_conv);
15149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15150 LDKMonitorUpdateError orig_conv;
15151 orig_conv.inner = (void*)(orig & (~1));
15152 orig_conv.is_owned = false;
15153 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
15154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15156 uint64_t ret_ref = (uint64_t)ret_var.inner;
15157 if (ret_var.is_owned) {
15163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15164 if ((this_ptr & 1) != 0) return;
15165 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
15166 FREE((void*)this_ptr);
15167 MonitorEvent_free(this_ptr_conv);
15170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15171 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
15172 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15173 *ret_copy = MonitorEvent_clone(orig_conv);
15174 uint64_t ret_ref = (uint64_t)ret_copy;
15178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
15179 LDKHTLCUpdate a_conv;
15180 a_conv.inner = (void*)(a & (~1));
15181 a_conv.is_owned = (a & 1) || (a == 0);
15182 a_conv = HTLCUpdate_clone(&a_conv);
15183 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15184 *ret_copy = MonitorEvent_htlcevent(a_conv);
15185 uint64_t ret_ref = (uint64_t)ret_copy;
15189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted(JNIEnv *env, jclass clz, int64_t a) {
15190 LDKOutPoint a_conv;
15191 a_conv.inner = (void*)(a & (~1));
15192 a_conv.is_owned = (a & 1) || (a == 0);
15193 a_conv = OutPoint_clone(&a_conv);
15194 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15195 *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
15196 uint64_t ret_ref = (uint64_t)ret_copy;
15200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15201 LDKHTLCUpdate this_obj_conv;
15202 this_obj_conv.inner = (void*)(this_obj & (~1));
15203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15204 HTLCUpdate_free(this_obj_conv);
15207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15208 LDKHTLCUpdate orig_conv;
15209 orig_conv.inner = (void*)(orig & (~1));
15210 orig_conv.is_owned = false;
15211 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
15212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15214 uint64_t ret_ref = (uint64_t)ret_var.inner;
15215 if (ret_var.is_owned) {
15221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15222 LDKHTLCUpdate obj_conv;
15223 obj_conv.inner = (void*)(obj & (~1));
15224 obj_conv.is_owned = false;
15225 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
15226 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15227 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15228 CVec_u8Z_free(ret_var);
15232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15233 LDKu8slice ser_ref;
15234 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15235 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15236 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15237 *ret_conv = HTLCUpdate_read(ser_ref);
15238 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15239 return (uint64_t)ret_conv;
15242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15243 LDKChannelMonitor this_obj_conv;
15244 this_obj_conv.inner = (void*)(this_obj & (~1));
15245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15246 ChannelMonitor_free(this_obj_conv);
15249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15250 LDKChannelMonitor orig_conv;
15251 orig_conv.inner = (void*)(orig & (~1));
15252 orig_conv.is_owned = false;
15253 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
15254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15256 uint64_t ret_ref = (uint64_t)ret_var.inner;
15257 if (ret_var.is_owned) {
15263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15264 LDKChannelMonitor obj_conv;
15265 obj_conv.inner = (void*)(obj & (~1));
15266 obj_conv.is_owned = false;
15267 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
15268 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15269 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15270 CVec_u8Z_free(ret_var);
15274 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) {
15275 LDKChannelMonitor this_arg_conv;
15276 this_arg_conv.inner = (void*)(this_arg & (~1));
15277 this_arg_conv.is_owned = false;
15278 LDKChannelMonitorUpdate updates_conv;
15279 updates_conv.inner = (void*)(updates & (~1));
15280 updates_conv.is_owned = false;
15281 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15282 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15283 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
15284 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
15285 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
15286 return (uint64_t)ret_conv;
15289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15290 LDKChannelMonitor this_arg_conv;
15291 this_arg_conv.inner = (void*)(this_arg & (~1));
15292 this_arg_conv.is_owned = false;
15293 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
15297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
15298 LDKChannelMonitor this_arg_conv;
15299 this_arg_conv.inner = (void*)(this_arg & (~1));
15300 this_arg_conv.is_owned = false;
15301 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15302 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
15303 return (uint64_t)ret_ref;
15306 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
15307 LDKChannelMonitor this_arg_conv;
15308 this_arg_conv.inner = (void*)(this_arg & (~1));
15309 this_arg_conv.is_owned = false;
15310 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
15311 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15312 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15313 for (size_t v = 0; v < ret_var.datalen; v++) {
15314 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15315 *ret_conv_47_ref = ret_var.data[v];
15316 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
15318 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15319 FREE(ret_var.data);
15323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
15324 LDKChannelMonitor this_arg_conv;
15325 this_arg_conv.inner = (void*)(this_arg & (~1));
15326 this_arg_conv.is_owned = false;
15327 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
15328 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
15331 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15332 LDKChannelMonitor this_arg_conv;
15333 this_arg_conv.inner = (void*)(this_arg & (~1));
15334 this_arg_conv.is_owned = false;
15335 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
15336 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15337 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15338 for (size_t o = 0; o < ret_var.datalen; o++) {
15339 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15340 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
15341 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
15342 ret_arr_ptr[o] = ret_conv_14_ref;
15344 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15345 FREE(ret_var.data);
15349 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15350 LDKChannelMonitor this_arg_conv;
15351 this_arg_conv.inner = (void*)(this_arg & (~1));
15352 this_arg_conv.is_owned = false;
15353 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
15354 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15355 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15356 for (size_t h = 0; h < ret_var.datalen; h++) {
15357 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15358 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
15359 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
15360 ret_arr_ptr[h] = ret_conv_7_ref;
15362 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15363 FREE(ret_var.data);
15367 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) {
15368 LDKChannelMonitor this_arg_conv;
15369 this_arg_conv.inner = (void*)(this_arg & (~1));
15370 this_arg_conv.is_owned = false;
15371 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
15372 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
15373 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
15375 for (size_t i = 0; i < ret_var.datalen; i++) {
15376 LDKTransaction ret_conv_8_var = ret_var.data[i];
15377 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
15378 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
15379 Transaction_free(ret_conv_8_var);
15380 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
15382 FREE(ret_var.data);
15386 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) {
15387 LDKChannelMonitor this_arg_conv;
15388 this_arg_conv.inner = (void*)(this_arg & (~1));
15389 this_arg_conv.is_owned = false;
15390 unsigned char header_arr[80];
15391 CHECK((*env)->GetArrayLength(env, header) == 80);
15392 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15393 unsigned char (*header_ref)[80] = &header_arr;
15394 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15395 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15396 if (txdata_constr.datalen > 0)
15397 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15399 txdata_constr.data = NULL;
15400 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15401 for (size_t y = 0; y < txdata_constr.datalen; y++) {
15402 int64_t txdata_conv_24 = txdata_vals[y];
15403 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
15404 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
15405 txdata_constr.data[y] = txdata_conv_24_conv;
15407 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15408 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15409 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15411 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15413 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15414 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15416 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15418 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15419 if (logger_conv.free == LDKLogger_JCalls_free) {
15420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15421 LDKLogger_JCalls_cloned(&logger_conv);
15423 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);
15424 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15425 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15426 for (size_t u = 0; u < ret_var.datalen; u++) {
15427 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15428 *ret_conv_46_ref = ret_var.data[u];
15429 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15431 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15432 FREE(ret_var.data);
15436 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) {
15437 LDKChannelMonitor this_arg_conv;
15438 this_arg_conv.inner = (void*)(this_arg & (~1));
15439 this_arg_conv.is_owned = false;
15440 unsigned char header_arr[80];
15441 CHECK((*env)->GetArrayLength(env, header) == 80);
15442 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15443 unsigned char (*header_ref)[80] = &header_arr;
15444 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15445 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15446 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15447 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15449 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15450 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15451 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15452 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15454 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15455 if (logger_conv.free == LDKLogger_JCalls_free) {
15456 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15457 LDKLogger_JCalls_cloned(&logger_conv);
15459 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15462 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) {
15463 LDKChannelMonitor this_arg_conv;
15464 this_arg_conv.inner = (void*)(this_arg & (~1));
15465 this_arg_conv.is_owned = false;
15466 unsigned char header_arr[80];
15467 CHECK((*env)->GetArrayLength(env, header) == 80);
15468 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15469 unsigned char (*header_ref)[80] = &header_arr;
15470 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15471 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15472 if (txdata_constr.datalen > 0)
15473 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15475 txdata_constr.data = NULL;
15476 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15477 for (size_t y = 0; y < txdata_constr.datalen; y++) {
15478 int64_t txdata_conv_24 = txdata_vals[y];
15479 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
15480 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
15481 txdata_constr.data[y] = txdata_conv_24_conv;
15483 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15484 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15485 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15486 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15487 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15489 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15490 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15491 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15492 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15494 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15495 if (logger_conv.free == LDKLogger_JCalls_free) {
15496 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15497 LDKLogger_JCalls_cloned(&logger_conv);
15499 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);
15500 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15501 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15502 for (size_t u = 0; u < ret_var.datalen; u++) {
15503 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15504 *ret_conv_46_ref = ret_var.data[u];
15505 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15507 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15508 FREE(ret_var.data);
15512 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) {
15513 LDKChannelMonitor this_arg_conv;
15514 this_arg_conv.inner = (void*)(this_arg & (~1));
15515 this_arg_conv.is_owned = false;
15516 unsigned char txid_arr[32];
15517 CHECK((*env)->GetArrayLength(env, txid) == 32);
15518 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15519 unsigned char (*txid_ref)[32] = &txid_arr;
15520 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15521 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15522 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15523 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15525 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15526 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15527 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15528 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15530 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15531 if (logger_conv.free == LDKLogger_JCalls_free) {
15532 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15533 LDKLogger_JCalls_cloned(&logger_conv);
15535 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
15538 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) {
15539 LDKChannelMonitor this_arg_conv;
15540 this_arg_conv.inner = (void*)(this_arg & (~1));
15541 this_arg_conv.is_owned = false;
15542 unsigned char header_arr[80];
15543 CHECK((*env)->GetArrayLength(env, header) == 80);
15544 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15545 unsigned char (*header_ref)[80] = &header_arr;
15546 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15547 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15548 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15549 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15551 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15552 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15553 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15554 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15556 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15557 if (logger_conv.free == LDKLogger_JCalls_free) {
15558 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15559 LDKLogger_JCalls_cloned(&logger_conv);
15561 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15562 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15563 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15564 for (size_t u = 0; u < ret_var.datalen; u++) {
15565 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15566 *ret_conv_46_ref = ret_var.data[u];
15567 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15569 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15570 FREE(ret_var.data);
15574 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15575 LDKChannelMonitor this_arg_conv;
15576 this_arg_conv.inner = (void*)(this_arg & (~1));
15577 this_arg_conv.is_owned = false;
15578 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
15579 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
15581 for (size_t i = 0; i < ret_var.datalen; i++) {
15582 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
15583 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
15584 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
15586 FREE(ret_var.data);
15590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
15591 LDKChannelMonitor this_arg_conv;
15592 this_arg_conv.inner = (void*)(this_arg & (~1));
15593 this_arg_conv.is_owned = false;
15594 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
15595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15597 uint64_t ret_ref = (uint64_t)ret_var.inner;
15598 if (ret_var.is_owned) {
15604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15605 if ((this_ptr & 1) != 0) return;
15606 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
15607 FREE((void*)this_ptr);
15608 Persist_free(this_ptr_conv);
15611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
15612 LDKu8slice ser_ref;
15613 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15614 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15615 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
15616 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
15617 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
15618 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15619 return (uint64_t)ret_conv;
15622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15623 LDKOutPoint this_obj_conv;
15624 this_obj_conv.inner = (void*)(this_obj & (~1));
15625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15626 OutPoint_free(this_obj_conv);
15629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15630 LDKOutPoint this_ptr_conv;
15631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15632 this_ptr_conv.is_owned = false;
15633 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15634 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
15638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15639 LDKOutPoint this_ptr_conv;
15640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15641 this_ptr_conv.is_owned = false;
15642 LDKThirtyTwoBytes val_ref;
15643 CHECK((*env)->GetArrayLength(env, val) == 32);
15644 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15645 OutPoint_set_txid(&this_ptr_conv, val_ref);
15648 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
15649 LDKOutPoint this_ptr_conv;
15650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15651 this_ptr_conv.is_owned = false;
15652 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
15656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15657 LDKOutPoint this_ptr_conv;
15658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15659 this_ptr_conv.is_owned = false;
15660 OutPoint_set_index(&this_ptr_conv, val);
15663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
15664 LDKThirtyTwoBytes txid_arg_ref;
15665 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15666 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15667 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
15668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15670 uint64_t ret_ref = (uint64_t)ret_var.inner;
15671 if (ret_var.is_owned) {
15677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15678 LDKOutPoint orig_conv;
15679 orig_conv.inner = (void*)(orig & (~1));
15680 orig_conv.is_owned = false;
15681 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
15682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15684 uint64_t ret_ref = (uint64_t)ret_var.inner;
15685 if (ret_var.is_owned) {
15691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15692 LDKOutPoint a_conv;
15693 a_conv.inner = (void*)(a & (~1));
15694 a_conv.is_owned = false;
15695 LDKOutPoint b_conv;
15696 b_conv.inner = (void*)(b & (~1));
15697 b_conv.is_owned = false;
15698 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
15702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
15703 LDKOutPoint o_conv;
15704 o_conv.inner = (void*)(o & (~1));
15705 o_conv.is_owned = false;
15706 int64_t ret_val = OutPoint_hash(&o_conv);
15710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15711 LDKOutPoint this_arg_conv;
15712 this_arg_conv.inner = (void*)(this_arg & (~1));
15713 this_arg_conv.is_owned = false;
15714 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
15719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
15720 LDKOutPoint obj_conv;
15721 obj_conv.inner = (void*)(obj & (~1));
15722 obj_conv.is_owned = false;
15723 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
15724 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15725 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15726 CVec_u8Z_free(ret_var);
15730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15731 LDKu8slice ser_ref;
15732 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15733 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15734 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15735 *ret_conv = OutPoint_read(ser_ref);
15736 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15737 return (uint64_t)ret_conv;
15740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15741 LDKDelayedPaymentOutputDescriptor this_obj_conv;
15742 this_obj_conv.inner = (void*)(this_obj & (~1));
15743 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15744 DelayedPaymentOutputDescriptor_free(this_obj_conv);
15747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15748 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15750 this_ptr_conv.is_owned = false;
15751 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15754 uint64_t ret_ref = (uint64_t)ret_var.inner;
15755 if (ret_var.is_owned) {
15761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15762 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15764 this_ptr_conv.is_owned = false;
15765 LDKOutPoint val_conv;
15766 val_conv.inner = (void*)(val & (~1));
15767 val_conv.is_owned = (val & 1) || (val == 0);
15768 val_conv = OutPoint_clone(&val_conv);
15769 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
15773 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15775 this_ptr_conv.is_owned = false;
15776 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
15781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15782 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15784 this_ptr_conv.is_owned = false;
15785 LDKPublicKey val_ref;
15786 CHECK((*env)->GetArrayLength(env, val) == 33);
15787 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15788 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
15791 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15792 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15794 this_ptr_conv.is_owned = false;
15795 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
15799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15800 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15802 this_ptr_conv.is_owned = false;
15803 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
15806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15807 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15809 this_ptr_conv.is_owned = false;
15810 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15811 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15815 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15817 this_ptr_conv.is_owned = false;
15818 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
15823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15824 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15826 this_ptr_conv.is_owned = false;
15827 LDKPublicKey val_ref;
15828 CHECK((*env)->GetArrayLength(env, val) == 33);
15829 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15830 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
15833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15834 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15836 this_ptr_conv.is_owned = false;
15837 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15843 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15845 this_ptr_conv.is_owned = false;
15846 LDKThirtyTwoBytes val_ref;
15847 CHECK((*env)->GetArrayLength(env, val) == 32);
15848 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15849 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15853 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15855 this_ptr_conv.is_owned = false;
15856 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15861 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15863 this_ptr_conv.is_owned = false;
15864 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15867 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) {
15868 LDKOutPoint outpoint_arg_conv;
15869 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15870 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15871 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15872 LDKPublicKey per_commitment_point_arg_ref;
15873 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
15874 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
15875 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
15876 LDKPublicKey revocation_pubkey_arg_ref;
15877 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
15878 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
15879 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15880 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
15881 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
15882 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);
15883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15885 uint64_t ret_ref = (uint64_t)ret_var.inner;
15886 if (ret_var.is_owned) {
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15893 LDKDelayedPaymentOutputDescriptor orig_conv;
15894 orig_conv.inner = (void*)(orig & (~1));
15895 orig_conv.is_owned = false;
15896 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
15897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15899 uint64_t ret_ref = (uint64_t)ret_var.inner;
15900 if (ret_var.is_owned) {
15906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15907 LDKDelayedPaymentOutputDescriptor obj_conv;
15908 obj_conv.inner = (void*)(obj & (~1));
15909 obj_conv.is_owned = false;
15910 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
15911 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15912 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15913 CVec_u8Z_free(ret_var);
15917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15918 LDKu8slice ser_ref;
15919 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15920 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15921 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15922 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
15923 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15924 return (uint64_t)ret_conv;
15927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15928 LDKStaticPaymentOutputDescriptor this_obj_conv;
15929 this_obj_conv.inner = (void*)(this_obj & (~1));
15930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15931 StaticPaymentOutputDescriptor_free(this_obj_conv);
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15935 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15937 this_ptr_conv.is_owned = false;
15938 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15941 uint64_t ret_ref = (uint64_t)ret_var.inner;
15942 if (ret_var.is_owned) {
15948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15949 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15951 this_ptr_conv.is_owned = false;
15952 LDKOutPoint val_conv;
15953 val_conv.inner = (void*)(val & (~1));
15954 val_conv.is_owned = (val & 1) || (val == 0);
15955 val_conv = OutPoint_clone(&val_conv);
15956 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15960 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15962 this_ptr_conv.is_owned = false;
15963 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15964 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15968 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15970 this_ptr_conv.is_owned = false;
15971 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15972 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15977 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15979 this_ptr_conv.is_owned = false;
15980 LDKThirtyTwoBytes val_ref;
15981 CHECK((*env)->GetArrayLength(env, val) == 32);
15982 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15983 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15987 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15989 this_ptr_conv.is_owned = false;
15990 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15995 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15997 this_ptr_conv.is_owned = false;
15998 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
16001 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) {
16002 LDKOutPoint outpoint_arg_conv;
16003 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16004 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16005 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16006 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
16007 LDKThirtyTwoBytes channel_keys_id_arg_ref;
16008 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
16009 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
16010 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
16011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16013 uint64_t ret_ref = (uint64_t)ret_var.inner;
16014 if (ret_var.is_owned) {
16020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16021 LDKStaticPaymentOutputDescriptor orig_conv;
16022 orig_conv.inner = (void*)(orig & (~1));
16023 orig_conv.is_owned = false;
16024 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
16025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16027 uint64_t ret_ref = (uint64_t)ret_var.inner;
16028 if (ret_var.is_owned) {
16034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16035 LDKStaticPaymentOutputDescriptor obj_conv;
16036 obj_conv.inner = (void*)(obj & (~1));
16037 obj_conv.is_owned = false;
16038 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
16039 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16040 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16041 CVec_u8Z_free(ret_var);
16045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16046 LDKu8slice ser_ref;
16047 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16048 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16049 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16050 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
16051 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16052 return (uint64_t)ret_conv;
16055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16056 if ((this_ptr & 1) != 0) return;
16057 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
16058 FREE((void*)this_ptr);
16059 SpendableOutputDescriptor_free(this_ptr_conv);
16062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16063 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
16064 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16065 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
16066 uint64_t ret_ref = (uint64_t)ret_copy;
16070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
16071 LDKOutPoint outpoint_conv;
16072 outpoint_conv.inner = (void*)(outpoint & (~1));
16073 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
16074 outpoint_conv = OutPoint_clone(&outpoint_conv);
16075 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
16076 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16077 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
16078 uint64_t ret_ref = (uint64_t)ret_copy;
16082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
16083 LDKDelayedPaymentOutputDescriptor a_conv;
16084 a_conv.inner = (void*)(a & (~1));
16085 a_conv.is_owned = (a & 1) || (a == 0);
16086 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
16087 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16088 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
16089 uint64_t ret_ref = (uint64_t)ret_copy;
16093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
16094 LDKStaticPaymentOutputDescriptor a_conv;
16095 a_conv.inner = (void*)(a & (~1));
16096 a_conv.is_owned = (a & 1) || (a == 0);
16097 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
16098 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16099 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
16100 uint64_t ret_ref = (uint64_t)ret_copy;
16104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16105 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
16106 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
16107 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16108 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16109 CVec_u8Z_free(ret_var);
16113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16114 LDKu8slice ser_ref;
16115 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16116 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16117 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16118 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
16119 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16120 return (uint64_t)ret_conv;
16123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16124 if ((this_ptr & 1) != 0) return;
16125 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
16126 FREE((void*)this_ptr);
16127 BaseSign_free(this_ptr_conv);
16130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16131 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
16132 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
16133 *ret = Sign_clone(orig_conv);
16134 return (uint64_t)ret;
16137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16138 if ((this_ptr & 1) != 0) return;
16139 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
16140 FREE((void*)this_ptr);
16141 Sign_free(this_ptr_conv);
16144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16145 if ((this_ptr & 1) != 0) return;
16146 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
16147 FREE((void*)this_ptr);
16148 KeysInterface_free(this_ptr_conv);
16151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16152 LDKInMemorySigner this_obj_conv;
16153 this_obj_conv.inner = (void*)(this_obj & (~1));
16154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16155 InMemorySigner_free(this_obj_conv);
16158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16159 LDKInMemorySigner this_ptr_conv;
16160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16161 this_ptr_conv.is_owned = false;
16162 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16163 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
16167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16168 LDKInMemorySigner this_ptr_conv;
16169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16170 this_ptr_conv.is_owned = false;
16171 LDKSecretKey val_ref;
16172 CHECK((*env)->GetArrayLength(env, val) == 32);
16173 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16174 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
16177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16178 LDKInMemorySigner this_ptr_conv;
16179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16180 this_ptr_conv.is_owned = false;
16181 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
16186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16187 LDKInMemorySigner this_ptr_conv;
16188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16189 this_ptr_conv.is_owned = false;
16190 LDKSecretKey val_ref;
16191 CHECK((*env)->GetArrayLength(env, val) == 32);
16192 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16193 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
16196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16197 LDKInMemorySigner this_ptr_conv;
16198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16199 this_ptr_conv.is_owned = false;
16200 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
16205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16206 LDKInMemorySigner this_ptr_conv;
16207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16208 this_ptr_conv.is_owned = false;
16209 LDKSecretKey val_ref;
16210 CHECK((*env)->GetArrayLength(env, val) == 32);
16211 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16212 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
16215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16216 LDKInMemorySigner this_ptr_conv;
16217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16218 this_ptr_conv.is_owned = false;
16219 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16220 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
16224 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) {
16225 LDKInMemorySigner this_ptr_conv;
16226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16227 this_ptr_conv.is_owned = false;
16228 LDKSecretKey val_ref;
16229 CHECK((*env)->GetArrayLength(env, val) == 32);
16230 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16231 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
16234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16235 LDKInMemorySigner this_ptr_conv;
16236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16237 this_ptr_conv.is_owned = false;
16238 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16239 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
16243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16244 LDKInMemorySigner this_ptr_conv;
16245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16246 this_ptr_conv.is_owned = false;
16247 LDKSecretKey val_ref;
16248 CHECK((*env)->GetArrayLength(env, val) == 32);
16249 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16250 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
16253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
16254 LDKInMemorySigner this_ptr_conv;
16255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16256 this_ptr_conv.is_owned = false;
16257 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
16262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16263 LDKInMemorySigner this_ptr_conv;
16264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16265 this_ptr_conv.is_owned = false;
16266 LDKThirtyTwoBytes val_ref;
16267 CHECK((*env)->GetArrayLength(env, val) == 32);
16268 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16269 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
16272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16273 LDKInMemorySigner orig_conv;
16274 orig_conv.inner = (void*)(orig & (~1));
16275 orig_conv.is_owned = false;
16276 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
16277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16279 uint64_t ret_ref = (uint64_t)ret_var.inner;
16280 if (ret_var.is_owned) {
16286 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) {
16287 LDKSecretKey funding_key_ref;
16288 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
16289 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
16290 LDKSecretKey revocation_base_key_ref;
16291 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
16292 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
16293 LDKSecretKey payment_key_ref;
16294 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
16295 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
16296 LDKSecretKey delayed_payment_base_key_ref;
16297 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
16298 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
16299 LDKSecretKey htlc_base_key_ref;
16300 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
16301 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
16302 LDKThirtyTwoBytes commitment_seed_ref;
16303 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
16304 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
16305 LDKThirtyTwoBytes channel_keys_id_ref;
16306 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
16307 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
16308 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);
16309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16311 uint64_t ret_ref = (uint64_t)ret_var.inner;
16312 if (ret_var.is_owned) {
16318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
16319 LDKInMemorySigner this_arg_conv;
16320 this_arg_conv.inner = (void*)(this_arg & (~1));
16321 this_arg_conv.is_owned = false;
16322 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
16323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16325 uint64_t ret_ref = (uint64_t)ret_var.inner;
16326 if (ret_var.is_owned) {
16332 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
16333 LDKInMemorySigner this_arg_conv;
16334 this_arg_conv.inner = (void*)(this_arg & (~1));
16335 this_arg_conv.is_owned = false;
16336 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
16340 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
16341 LDKInMemorySigner this_arg_conv;
16342 this_arg_conv.inner = (void*)(this_arg & (~1));
16343 this_arg_conv.is_owned = false;
16344 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
16348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
16349 LDKInMemorySigner this_arg_conv;
16350 this_arg_conv.inner = (void*)(this_arg & (~1));
16351 this_arg_conv.is_owned = false;
16352 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
16356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
16357 LDKInMemorySigner this_arg_conv;
16358 this_arg_conv.inner = (void*)(this_arg & (~1));
16359 this_arg_conv.is_owned = false;
16360 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
16361 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16362 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16363 uint64_t ret_ref = (uint64_t)ret_var.inner;
16364 if (ret_var.is_owned) {
16370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
16371 LDKInMemorySigner this_arg_conv;
16372 this_arg_conv.inner = (void*)(this_arg & (~1));
16373 this_arg_conv.is_owned = false;
16374 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
16375 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16376 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16377 uint64_t ret_ref = (uint64_t)ret_var.inner;
16378 if (ret_var.is_owned) {
16384 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) {
16385 LDKInMemorySigner this_arg_conv;
16386 this_arg_conv.inner = (void*)(this_arg & (~1));
16387 this_arg_conv.is_owned = false;
16388 LDKTransaction spend_tx_ref;
16389 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
16390 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
16391 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
16392 spend_tx_ref.data_is_owned = true;
16393 LDKStaticPaymentOutputDescriptor descriptor_conv;
16394 descriptor_conv.inner = (void*)(descriptor & (~1));
16395 descriptor_conv.is_owned = false;
16396 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16397 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
16398 return (uint64_t)ret_conv;
16401 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) {
16402 LDKInMemorySigner this_arg_conv;
16403 this_arg_conv.inner = (void*)(this_arg & (~1));
16404 this_arg_conv.is_owned = false;
16405 LDKTransaction spend_tx_ref;
16406 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
16407 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
16408 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
16409 spend_tx_ref.data_is_owned = true;
16410 LDKDelayedPaymentOutputDescriptor descriptor_conv;
16411 descriptor_conv.inner = (void*)(descriptor & (~1));
16412 descriptor_conv.is_owned = false;
16413 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16414 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
16415 return (uint64_t)ret_conv;
16418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
16419 LDKInMemorySigner this_arg_conv;
16420 this_arg_conv.inner = (void*)(this_arg & (~1));
16421 this_arg_conv.is_owned = false;
16422 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
16423 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
16424 return (uint64_t)ret;
16427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
16428 LDKInMemorySigner this_arg_conv;
16429 this_arg_conv.inner = (void*)(this_arg & (~1));
16430 this_arg_conv.is_owned = false;
16431 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
16432 *ret = InMemorySigner_as_Sign(&this_arg_conv);
16433 return (uint64_t)ret;
16436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
16437 LDKInMemorySigner obj_conv;
16438 obj_conv.inner = (void*)(obj & (~1));
16439 obj_conv.is_owned = false;
16440 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
16441 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16442 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16443 CVec_u8Z_free(ret_var);
16447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16448 LDKu8slice ser_ref;
16449 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16450 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16451 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16452 *ret_conv = InMemorySigner_read(ser_ref);
16453 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16454 return (uint64_t)ret_conv;
16457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16458 LDKKeysManager this_obj_conv;
16459 this_obj_conv.inner = (void*)(this_obj & (~1));
16460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16461 KeysManager_free(this_obj_conv);
16464 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) {
16465 unsigned char seed_arr[32];
16466 CHECK((*env)->GetArrayLength(env, seed) == 32);
16467 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
16468 unsigned char (*seed_ref)[32] = &seed_arr;
16469 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
16470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16472 uint64_t ret_ref = (uint64_t)ret_var.inner;
16473 if (ret_var.is_owned) {
16479 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) {
16480 LDKKeysManager this_arg_conv;
16481 this_arg_conv.inner = (void*)(this_arg & (~1));
16482 this_arg_conv.is_owned = false;
16483 unsigned char params_arr[32];
16484 CHECK((*env)->GetArrayLength(env, params) == 32);
16485 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
16486 unsigned char (*params_ref)[32] = ¶ms_arr;
16487 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
16488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16490 uint64_t ret_ref = (uint64_t)ret_var.inner;
16491 if (ret_var.is_owned) {
16497 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) {
16498 LDKKeysManager this_arg_conv;
16499 this_arg_conv.inner = (void*)(this_arg & (~1));
16500 this_arg_conv.is_owned = false;
16501 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
16502 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
16503 if (descriptors_constr.datalen > 0)
16504 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16506 descriptors_constr.data = NULL;
16507 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
16508 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
16509 int64_t descriptors_conv_27 = descriptors_vals[b];
16510 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
16511 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
16512 descriptors_constr.data[b] = descriptors_conv_27_conv;
16514 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
16515 LDKCVec_TxOutZ outputs_constr;
16516 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
16517 if (outputs_constr.datalen > 0)
16518 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16520 outputs_constr.data = NULL;
16521 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
16522 for (size_t h = 0; h < outputs_constr.datalen; h++) {
16523 int64_t outputs_conv_7 = outputs_vals[h];
16524 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
16525 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
16526 outputs_constr.data[h] = outputs_conv_7_conv;
16528 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
16529 LDKCVec_u8Z change_destination_script_ref;
16530 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
16531 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
16532 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
16533 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16534 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
16535 return (uint64_t)ret_conv;
16538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
16539 LDKKeysManager this_arg_conv;
16540 this_arg_conv.inner = (void*)(this_arg & (~1));
16541 this_arg_conv.is_owned = false;
16542 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
16543 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
16544 return (uint64_t)ret;
16547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16548 LDKChannelManager this_obj_conv;
16549 this_obj_conv.inner = (void*)(this_obj & (~1));
16550 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16551 ChannelManager_free(this_obj_conv);
16554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16555 LDKChainParameters this_obj_conv;
16556 this_obj_conv.inner = (void*)(this_obj & (~1));
16557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16558 ChainParameters_free(this_obj_conv);
16561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
16562 LDKChainParameters this_ptr_conv;
16563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16564 this_ptr_conv.is_owned = false;
16565 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
16569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
16570 LDKChainParameters this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
16574 ChainParameters_set_network(&this_ptr_conv, val_conv);
16577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
16578 LDKChainParameters this_ptr_conv;
16579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16580 this_ptr_conv.is_owned = false;
16581 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
16582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16584 uint64_t ret_ref = (uint64_t)ret_var.inner;
16585 if (ret_var.is_owned) {
16591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16592 LDKChainParameters this_ptr_conv;
16593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16594 this_ptr_conv.is_owned = false;
16595 LDKBestBlock val_conv;
16596 val_conv.inner = (void*)(val & (~1));
16597 val_conv.is_owned = (val & 1) || (val == 0);
16598 val_conv = BestBlock_clone(&val_conv);
16599 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
16602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
16603 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
16604 LDKBestBlock best_block_arg_conv;
16605 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
16606 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
16607 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
16608 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
16609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16611 uint64_t ret_ref = (uint64_t)ret_var.inner;
16612 if (ret_var.is_owned) {
16618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16619 LDKChainParameters orig_conv;
16620 orig_conv.inner = (void*)(orig & (~1));
16621 orig_conv.is_owned = false;
16622 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
16623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16625 uint64_t ret_ref = (uint64_t)ret_var.inner;
16626 if (ret_var.is_owned) {
16632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16633 LDKChannelCounterparty this_obj_conv;
16634 this_obj_conv.inner = (void*)(this_obj & (~1));
16635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16636 ChannelCounterparty_free(this_obj_conv);
16639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16640 LDKChannelCounterparty this_ptr_conv;
16641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16642 this_ptr_conv.is_owned = false;
16643 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16644 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
16648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16649 LDKChannelCounterparty this_ptr_conv;
16650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16651 this_ptr_conv.is_owned = false;
16652 LDKPublicKey val_ref;
16653 CHECK((*env)->GetArrayLength(env, val) == 33);
16654 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16655 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
16658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16659 LDKChannelCounterparty this_ptr_conv;
16660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16661 this_ptr_conv.is_owned = false;
16662 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
16663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16665 uint64_t ret_ref = (uint64_t)ret_var.inner;
16666 if (ret_var.is_owned) {
16672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16673 LDKChannelCounterparty this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 LDKInitFeatures val_conv;
16677 val_conv.inner = (void*)(val & (~1));
16678 val_conv.is_owned = (val & 1) || (val == 0);
16679 val_conv = InitFeatures_clone(&val_conv);
16680 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
16683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16684 LDKChannelCounterparty this_ptr_conv;
16685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16686 this_ptr_conv.is_owned = false;
16687 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
16691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16692 LDKChannelCounterparty this_ptr_conv;
16693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16694 this_ptr_conv.is_owned = false;
16695 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
16698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16699 LDKChannelCounterparty orig_conv;
16700 orig_conv.inner = (void*)(orig & (~1));
16701 orig_conv.is_owned = false;
16702 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
16703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16705 uint64_t ret_ref = (uint64_t)ret_var.inner;
16706 if (ret_var.is_owned) {
16712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16713 LDKChannelDetails this_obj_conv;
16714 this_obj_conv.inner = (void*)(this_obj & (~1));
16715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16716 ChannelDetails_free(this_obj_conv);
16719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16720 LDKChannelDetails this_ptr_conv;
16721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16722 this_ptr_conv.is_owned = false;
16723 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
16728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16729 LDKChannelDetails this_ptr_conv;
16730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16731 this_ptr_conv.is_owned = false;
16732 LDKThirtyTwoBytes val_ref;
16733 CHECK((*env)->GetArrayLength(env, val) == 32);
16734 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16735 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
16738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
16739 LDKChannelDetails this_ptr_conv;
16740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16741 this_ptr_conv.is_owned = false;
16742 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
16743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16745 uint64_t ret_ref = (uint64_t)ret_var.inner;
16746 if (ret_var.is_owned) {
16752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16753 LDKChannelDetails this_ptr_conv;
16754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16755 this_ptr_conv.is_owned = false;
16756 LDKChannelCounterparty val_conv;
16757 val_conv.inner = (void*)(val & (~1));
16758 val_conv.is_owned = (val & 1) || (val == 0);
16759 val_conv = ChannelCounterparty_clone(&val_conv);
16760 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
16763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
16764 LDKChannelDetails this_ptr_conv;
16765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16766 this_ptr_conv.is_owned = false;
16767 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
16768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16770 uint64_t ret_ref = (uint64_t)ret_var.inner;
16771 if (ret_var.is_owned) {
16777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16778 LDKChannelDetails this_ptr_conv;
16779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16780 this_ptr_conv.is_owned = false;
16781 LDKOutPoint val_conv;
16782 val_conv.inner = (void*)(val & (~1));
16783 val_conv.is_owned = (val & 1) || (val == 0);
16784 val_conv = OutPoint_clone(&val_conv);
16785 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16789 LDKChannelDetails this_ptr_conv;
16790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16791 this_ptr_conv.is_owned = false;
16792 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16793 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
16794 uint64_t ret_ref = (uint64_t)ret_copy;
16798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16799 LDKChannelDetails this_ptr_conv;
16800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16801 this_ptr_conv.is_owned = false;
16802 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16803 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
16806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16807 LDKChannelDetails this_ptr_conv;
16808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16809 this_ptr_conv.is_owned = false;
16810 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
16814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16815 LDKChannelDetails this_ptr_conv;
16816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16817 this_ptr_conv.is_owned = false;
16818 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
16821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16822 LDKChannelDetails this_ptr_conv;
16823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16824 this_ptr_conv.is_owned = false;
16825 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16826 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16827 uint64_t ret_ref = (uint64_t)ret_copy;
16831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16832 LDKChannelDetails this_ptr_conv;
16833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16834 this_ptr_conv.is_owned = false;
16835 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16836 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16840 LDKChannelDetails this_ptr_conv;
16841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16842 this_ptr_conv.is_owned = false;
16843 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
16847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16848 LDKChannelDetails this_ptr_conv;
16849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16850 this_ptr_conv.is_owned = false;
16851 ChannelDetails_set_user_id(&this_ptr_conv, val);
16854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16855 LDKChannelDetails this_ptr_conv;
16856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16857 this_ptr_conv.is_owned = false;
16858 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16863 LDKChannelDetails this_ptr_conv;
16864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16865 this_ptr_conv.is_owned = false;
16866 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16870 LDKChannelDetails this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16878 LDKChannelDetails this_ptr_conv;
16879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16880 this_ptr_conv.is_owned = false;
16881 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
16885 LDKChannelDetails this_ptr_conv;
16886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16887 this_ptr_conv.is_owned = false;
16888 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16889 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16890 uint64_t ret_ref = (uint64_t)ret_copy;
16894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16895 LDKChannelDetails this_ptr_conv;
16896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16897 this_ptr_conv.is_owned = false;
16898 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
16899 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16903 LDKChannelDetails this_ptr_conv;
16904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16905 this_ptr_conv.is_owned = false;
16906 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16907 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16908 uint64_t ret_ref = (uint64_t)ret_copy;
16912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16913 LDKChannelDetails this_ptr_conv;
16914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16915 this_ptr_conv.is_owned = false;
16916 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
16917 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
16921 LDKChannelDetails this_ptr_conv;
16922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16923 this_ptr_conv.is_owned = false;
16924 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16929 LDKChannelDetails this_ptr_conv;
16930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16931 this_ptr_conv.is_owned = false;
16932 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
16936 LDKChannelDetails this_ptr_conv;
16937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16938 this_ptr_conv.is_owned = false;
16939 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16944 LDKChannelDetails this_ptr_conv;
16945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16946 this_ptr_conv.is_owned = false;
16947 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
16951 LDKChannelDetails this_ptr_conv;
16952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16953 this_ptr_conv.is_owned = false;
16954 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16959 LDKChannelDetails this_ptr_conv;
16960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16961 this_ptr_conv.is_owned = false;
16962 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
16966 LDKChannelDetails this_ptr_conv;
16967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16968 this_ptr_conv.is_owned = false;
16969 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16974 LDKChannelDetails this_ptr_conv;
16975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16976 this_ptr_conv.is_owned = false;
16977 ChannelDetails_set_is_public(&this_ptr_conv, val);
16980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
16981 LDKThirtyTwoBytes channel_id_arg_ref;
16982 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16983 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16984 LDKChannelCounterparty counterparty_arg_conv;
16985 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16986 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16987 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16988 LDKOutPoint funding_txo_arg_conv;
16989 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16990 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16991 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16992 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
16993 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16994 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
16995 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16996 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
16997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16999 uint64_t ret_ref = (uint64_t)ret_var.inner;
17000 if (ret_var.is_owned) {
17006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17007 LDKChannelDetails orig_conv;
17008 orig_conv.inner = (void*)(orig & (~1));
17009 orig_conv.is_owned = false;
17010 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
17011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17013 uint64_t ret_ref = (uint64_t)ret_var.inner;
17014 if (ret_var.is_owned) {
17020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17021 if ((this_ptr & 1) != 0) return;
17022 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
17023 FREE((void*)this_ptr);
17024 PaymentSendFailure_free(this_ptr_conv);
17027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17028 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
17029 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17030 *ret_copy = PaymentSendFailure_clone(orig_conv);
17031 uint64_t ret_ref = (uint64_t)ret_copy;
17035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
17036 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
17037 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17038 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
17039 uint64_t ret_ref = (uint64_t)ret_copy;
17043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
17044 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
17045 a_constr.datalen = (*env)->GetArrayLength(env, a);
17046 if (a_constr.datalen > 0)
17047 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17049 a_constr.data = NULL;
17050 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17051 for (size_t w = 0; w < a_constr.datalen; w++) {
17052 int64_t a_conv_22 = a_vals[w];
17053 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
17054 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
17055 a_constr.data[w] = a_conv_22_conv;
17057 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17058 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17059 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
17060 uint64_t ret_ref = (uint64_t)ret_copy;
17064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
17065 LDKCVec_APIErrorZ a_constr;
17066 a_constr.datalen = (*env)->GetArrayLength(env, a);
17067 if (a_constr.datalen > 0)
17068 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17070 a_constr.data = NULL;
17071 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17072 for (size_t k = 0; k < a_constr.datalen; k++) {
17073 int64_t a_conv_10 = a_vals[k];
17074 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
17075 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
17076 a_constr.data[k] = a_conv_10_conv;
17078 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17079 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17080 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
17081 uint64_t ret_ref = (uint64_t)ret_copy;
17085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
17086 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
17087 a_constr.datalen = (*env)->GetArrayLength(env, a);
17088 if (a_constr.datalen > 0)
17089 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17091 a_constr.data = NULL;
17092 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17093 for (size_t w = 0; w < a_constr.datalen; w++) {
17094 int64_t a_conv_22 = a_vals[w];
17095 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
17096 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
17097 a_constr.data[w] = a_conv_22_conv;
17099 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17100 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17101 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
17102 uint64_t ret_ref = (uint64_t)ret_copy;
17106 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) {
17107 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
17108 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
17109 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17110 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
17112 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
17113 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
17114 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17115 LDKWatch_JCalls_cloned(&chain_monitor_conv);
17117 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
17118 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17119 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17120 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
17122 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17123 if (logger_conv.free == LDKLogger_JCalls_free) {
17124 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17125 LDKLogger_JCalls_cloned(&logger_conv);
17127 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
17128 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
17129 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17130 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
17132 LDKUserConfig config_conv;
17133 config_conv.inner = (void*)(config & (~1));
17134 config_conv.is_owned = (config & 1) || (config == 0);
17135 config_conv = UserConfig_clone(&config_conv);
17136 LDKChainParameters params_conv;
17137 params_conv.inner = (void*)(params & (~1));
17138 params_conv.is_owned = (params & 1) || (params == 0);
17139 params_conv = ChainParameters_clone(¶ms_conv);
17140 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
17141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17143 uint64_t ret_ref = (uint64_t)ret_var.inner;
17144 if (ret_var.is_owned) {
17150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
17151 LDKChannelManager this_arg_conv;
17152 this_arg_conv.inner = (void*)(this_arg & (~1));
17153 this_arg_conv.is_owned = false;
17154 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
17155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17157 uint64_t ret_ref = (uint64_t)ret_var.inner;
17158 if (ret_var.is_owned) {
17164 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) {
17165 LDKChannelManager this_arg_conv;
17166 this_arg_conv.inner = (void*)(this_arg & (~1));
17167 this_arg_conv.is_owned = false;
17168 LDKPublicKey their_network_key_ref;
17169 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
17170 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
17171 LDKUserConfig override_config_conv;
17172 override_config_conv.inner = (void*)(override_config & (~1));
17173 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
17174 override_config_conv = UserConfig_clone(&override_config_conv);
17175 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17176 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
17177 return (uint64_t)ret_conv;
17180 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17181 LDKChannelManager this_arg_conv;
17182 this_arg_conv.inner = (void*)(this_arg & (~1));
17183 this_arg_conv.is_owned = false;
17184 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
17185 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17186 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17187 for (size_t q = 0; q < ret_var.datalen; q++) {
17188 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
17189 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17190 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17191 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
17192 if (ret_conv_16_var.is_owned) {
17193 ret_conv_16_ref |= 1;
17195 ret_arr_ptr[q] = ret_conv_16_ref;
17197 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17198 FREE(ret_var.data);
17202 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17203 LDKChannelManager this_arg_conv;
17204 this_arg_conv.inner = (void*)(this_arg & (~1));
17205 this_arg_conv.is_owned = false;
17206 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
17207 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17208 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17209 for (size_t q = 0; q < ret_var.datalen; q++) {
17210 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
17211 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17212 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17213 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
17214 if (ret_conv_16_var.is_owned) {
17215 ret_conv_16_ref |= 1;
17217 ret_arr_ptr[q] = ret_conv_16_ref;
17219 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17220 FREE(ret_var.data);
17224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
17225 LDKChannelManager this_arg_conv;
17226 this_arg_conv.inner = (void*)(this_arg & (~1));
17227 this_arg_conv.is_owned = false;
17228 unsigned char channel_id_arr[32];
17229 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17230 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17231 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17232 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17233 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
17234 return (uint64_t)ret_conv;
17237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
17238 LDKChannelManager this_arg_conv;
17239 this_arg_conv.inner = (void*)(this_arg & (~1));
17240 this_arg_conv.is_owned = false;
17241 unsigned char channel_id_arr[32];
17242 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17243 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17244 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17245 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17246 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
17247 return (uint64_t)ret_conv;
17250 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) {
17251 LDKChannelManager this_arg_conv;
17252 this_arg_conv.inner = (void*)(this_arg & (~1));
17253 this_arg_conv.is_owned = false;
17254 unsigned char channel_id_arr[32];
17255 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17256 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17257 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17258 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17259 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
17260 return (uint64_t)ret_conv;
17263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17264 LDKChannelManager this_arg_conv;
17265 this_arg_conv.inner = (void*)(this_arg & (~1));
17266 this_arg_conv.is_owned = false;
17267 ChannelManager_force_close_all_channels(&this_arg_conv);
17270 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) {
17271 LDKChannelManager this_arg_conv;
17272 this_arg_conv.inner = (void*)(this_arg & (~1));
17273 this_arg_conv.is_owned = false;
17274 LDKRoute route_conv;
17275 route_conv.inner = (void*)(route & (~1));
17276 route_conv.is_owned = false;
17277 LDKThirtyTwoBytes payment_hash_ref;
17278 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17279 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17280 LDKThirtyTwoBytes payment_secret_ref;
17281 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
17282 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
17283 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17284 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
17285 return (uint64_t)ret_conv;
17288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
17289 LDKChannelManager this_arg_conv;
17290 this_arg_conv.inner = (void*)(this_arg & (~1));
17291 this_arg_conv.is_owned = false;
17292 LDKRoute route_conv;
17293 route_conv.inner = (void*)(route & (~1));
17294 route_conv.is_owned = false;
17295 LDKThirtyTwoBytes payment_preimage_ref;
17296 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17297 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17298 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17299 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
17300 return (uint64_t)ret_conv;
17303 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) {
17304 LDKChannelManager this_arg_conv;
17305 this_arg_conv.inner = (void*)(this_arg & (~1));
17306 this_arg_conv.is_owned = false;
17307 unsigned char temporary_channel_id_arr[32];
17308 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
17309 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
17310 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
17311 LDKTransaction funding_transaction_ref;
17312 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
17313 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
17314 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
17315 funding_transaction_ref.data_is_owned = true;
17316 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17317 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
17318 return (uint64_t)ret_conv;
17321 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) {
17322 LDKChannelManager this_arg_conv;
17323 this_arg_conv.inner = (void*)(this_arg & (~1));
17324 this_arg_conv.is_owned = false;
17325 LDKThreeBytes rgb_ref;
17326 CHECK((*env)->GetArrayLength(env, rgb) == 3);
17327 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
17328 LDKThirtyTwoBytes alias_ref;
17329 CHECK((*env)->GetArrayLength(env, alias) == 32);
17330 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
17331 LDKCVec_NetAddressZ addresses_constr;
17332 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
17333 if (addresses_constr.datalen > 0)
17334 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17336 addresses_constr.data = NULL;
17337 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
17338 for (size_t m = 0; m < addresses_constr.datalen; m++) {
17339 int64_t addresses_conv_12 = addresses_vals[m];
17340 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
17341 addresses_constr.data[m] = addresses_conv_12_conv;
17343 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
17344 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
17347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
17348 LDKChannelManager this_arg_conv;
17349 this_arg_conv.inner = (void*)(this_arg & (~1));
17350 this_arg_conv.is_owned = false;
17351 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
17354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
17355 LDKChannelManager this_arg_conv;
17356 this_arg_conv.inner = (void*)(this_arg & (~1));
17357 this_arg_conv.is_owned = false;
17358 ChannelManager_timer_tick_occurred(&this_arg_conv);
17361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
17362 LDKChannelManager this_arg_conv;
17363 this_arg_conv.inner = (void*)(this_arg & (~1));
17364 this_arg_conv.is_owned = false;
17365 unsigned char payment_hash_arr[32];
17366 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17367 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
17368 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
17369 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
17373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
17374 LDKChannelManager this_arg_conv;
17375 this_arg_conv.inner = (void*)(this_arg & (~1));
17376 this_arg_conv.is_owned = false;
17377 LDKThirtyTwoBytes payment_preimage_ref;
17378 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17379 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17380 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
17384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17385 LDKChannelManager this_arg_conv;
17386 this_arg_conv.inner = (void*)(this_arg & (~1));
17387 this_arg_conv.is_owned = false;
17388 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17389 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
17393 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) {
17394 LDKChannelManager this_arg_conv;
17395 this_arg_conv.inner = (void*)(this_arg & (~1));
17396 this_arg_conv.is_owned = false;
17397 LDKOutPoint funding_txo_conv;
17398 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17399 funding_txo_conv.is_owned = false;
17400 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
17403 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) {
17404 LDKChannelManager this_arg_conv;
17405 this_arg_conv.inner = (void*)(this_arg & (~1));
17406 this_arg_conv.is_owned = false;
17407 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
17408 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17409 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
17410 return (uint64_t)ret_ref;
17413 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) {
17414 LDKChannelManager this_arg_conv;
17415 this_arg_conv.inner = (void*)(this_arg & (~1));
17416 this_arg_conv.is_owned = false;
17417 LDKThirtyTwoBytes payment_hash_ref;
17418 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17419 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17420 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
17421 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17422 *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);
17423 return (uint64_t)ret_conv;
17426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17427 LDKChannelManager this_arg_conv;
17428 this_arg_conv.inner = (void*)(this_arg & (~1));
17429 this_arg_conv.is_owned = false;
17430 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17431 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
17432 return (uint64_t)ret;
17435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17436 LDKChannelManager this_arg_conv;
17437 this_arg_conv.inner = (void*)(this_arg & (~1));
17438 this_arg_conv.is_owned = false;
17439 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17440 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
17441 return (uint64_t)ret;
17444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
17445 LDKChannelManager this_arg_conv;
17446 this_arg_conv.inner = (void*)(this_arg & (~1));
17447 this_arg_conv.is_owned = false;
17448 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
17449 *ret = ChannelManager_as_Listen(&this_arg_conv);
17450 return (uint64_t)ret;
17453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
17454 LDKChannelManager this_arg_conv;
17455 this_arg_conv.inner = (void*)(this_arg & (~1));
17456 this_arg_conv.is_owned = false;
17457 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17458 *ret = ChannelManager_as_Confirm(&this_arg_conv);
17459 return (uint64_t)ret;
17462 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) {
17463 LDKChannelManager this_arg_conv;
17464 this_arg_conv.inner = (void*)(this_arg & (~1));
17465 this_arg_conv.is_owned = false;
17466 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
17470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
17471 LDKChannelManager this_arg_conv;
17472 this_arg_conv.inner = (void*)(this_arg & (~1));
17473 this_arg_conv.is_owned = false;
17474 ChannelManager_await_persistable_update(&this_arg_conv);
17477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
17478 LDKChannelManager this_arg_conv;
17479 this_arg_conv.inner = (void*)(this_arg & (~1));
17480 this_arg_conv.is_owned = false;
17481 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
17482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17484 uint64_t ret_ref = (uint64_t)ret_var.inner;
17485 if (ret_var.is_owned) {
17491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17492 LDKChannelManager this_arg_conv;
17493 this_arg_conv.inner = (void*)(this_arg & (~1));
17494 this_arg_conv.is_owned = false;
17495 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17496 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
17497 return (uint64_t)ret;
17500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
17501 LDKChannelManager obj_conv;
17502 obj_conv.inner = (void*)(obj & (~1));
17503 obj_conv.is_owned = false;
17504 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
17505 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17506 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17507 CVec_u8Z_free(ret_var);
17511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17512 LDKChannelManagerReadArgs this_obj_conv;
17513 this_obj_conv.inner = (void*)(this_obj & (~1));
17514 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17515 ChannelManagerReadArgs_free(this_obj_conv);
17518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
17519 LDKChannelManagerReadArgs this_ptr_conv;
17520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17521 this_ptr_conv.is_owned = false;
17522 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
17526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17527 LDKChannelManagerReadArgs this_ptr_conv;
17528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17529 this_ptr_conv.is_owned = false;
17530 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
17531 if (val_conv.free == LDKKeysInterface_JCalls_free) {
17532 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17533 LDKKeysInterface_JCalls_cloned(&val_conv);
17535 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
17538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
17539 LDKChannelManagerReadArgs this_ptr_conv;
17540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17541 this_ptr_conv.is_owned = false;
17542 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
17546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17547 LDKChannelManagerReadArgs this_ptr_conv;
17548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17549 this_ptr_conv.is_owned = false;
17550 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
17551 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
17552 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17553 LDKFeeEstimator_JCalls_cloned(&val_conv);
17555 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
17558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
17559 LDKChannelManagerReadArgs this_ptr_conv;
17560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17561 this_ptr_conv.is_owned = false;
17562 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
17566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17567 LDKChannelManagerReadArgs this_ptr_conv;
17568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17569 this_ptr_conv.is_owned = false;
17570 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
17571 if (val_conv.free == LDKWatch_JCalls_free) {
17572 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17573 LDKWatch_JCalls_cloned(&val_conv);
17575 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
17578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
17579 LDKChannelManagerReadArgs this_ptr_conv;
17580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17581 this_ptr_conv.is_owned = false;
17582 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
17586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17587 LDKChannelManagerReadArgs this_ptr_conv;
17588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17589 this_ptr_conv.is_owned = false;
17590 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
17591 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
17592 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17593 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
17595 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
17598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
17599 LDKChannelManagerReadArgs this_ptr_conv;
17600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17601 this_ptr_conv.is_owned = false;
17602 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
17606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17607 LDKChannelManagerReadArgs this_ptr_conv;
17608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17609 this_ptr_conv.is_owned = false;
17610 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
17611 if (val_conv.free == LDKLogger_JCalls_free) {
17612 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17613 LDKLogger_JCalls_cloned(&val_conv);
17615 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
17618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
17619 LDKChannelManagerReadArgs this_ptr_conv;
17620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17621 this_ptr_conv.is_owned = false;
17622 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
17623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17625 uint64_t ret_ref = (uint64_t)ret_var.inner;
17626 if (ret_var.is_owned) {
17632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17633 LDKChannelManagerReadArgs this_ptr_conv;
17634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17635 this_ptr_conv.is_owned = false;
17636 LDKUserConfig val_conv;
17637 val_conv.inner = (void*)(val & (~1));
17638 val_conv.is_owned = (val & 1) || (val == 0);
17639 val_conv = UserConfig_clone(&val_conv);
17640 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
17643 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) {
17644 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
17645 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
17646 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17647 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
17649 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17650 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17651 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17652 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17654 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
17655 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
17656 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17657 LDKWatch_JCalls_cloned(&chain_monitor_conv);
17659 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
17660 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17661 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17662 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
17664 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17665 if (logger_conv.free == LDKLogger_JCalls_free) {
17666 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17667 LDKLogger_JCalls_cloned(&logger_conv);
17669 LDKUserConfig default_config_conv;
17670 default_config_conv.inner = (void*)(default_config & (~1));
17671 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
17672 default_config_conv = UserConfig_clone(&default_config_conv);
17673 LDKCVec_ChannelMonitorZ channel_monitors_constr;
17674 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
17675 if (channel_monitors_constr.datalen > 0)
17676 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17678 channel_monitors_constr.data = NULL;
17679 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
17680 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
17681 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
17682 LDKChannelMonitor channel_monitors_conv_16_conv;
17683 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
17684 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
17685 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
17687 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
17688 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);
17689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17691 uint64_t ret_ref = (uint64_t)ret_var.inner;
17692 if (ret_var.is_owned) {
17698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
17699 LDKu8slice ser_ref;
17700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17702 LDKChannelManagerReadArgs arg_conv;
17703 arg_conv.inner = (void*)(arg & (~1));
17704 arg_conv.is_owned = (arg & 1) || (arg == 0);
17705 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
17706 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17707 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
17708 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17709 return (uint64_t)ret_conv;
17712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17713 LDKDecodeError this_obj_conv;
17714 this_obj_conv.inner = (void*)(this_obj & (~1));
17715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17716 DecodeError_free(this_obj_conv);
17719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17720 LDKDecodeError orig_conv;
17721 orig_conv.inner = (void*)(orig & (~1));
17722 orig_conv.is_owned = false;
17723 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
17724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17726 uint64_t ret_ref = (uint64_t)ret_var.inner;
17727 if (ret_var.is_owned) {
17733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17734 LDKInit this_obj_conv;
17735 this_obj_conv.inner = (void*)(this_obj & (~1));
17736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17737 Init_free(this_obj_conv);
17740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
17741 LDKInit this_ptr_conv;
17742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17743 this_ptr_conv.is_owned = false;
17744 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
17745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17747 uint64_t ret_ref = (uint64_t)ret_var.inner;
17748 if (ret_var.is_owned) {
17754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17755 LDKInit this_ptr_conv;
17756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17757 this_ptr_conv.is_owned = false;
17758 LDKInitFeatures val_conv;
17759 val_conv.inner = (void*)(val & (~1));
17760 val_conv.is_owned = (val & 1) || (val == 0);
17761 val_conv = InitFeatures_clone(&val_conv);
17762 Init_set_features(&this_ptr_conv, val_conv);
17765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
17766 LDKInitFeatures features_arg_conv;
17767 features_arg_conv.inner = (void*)(features_arg & (~1));
17768 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17769 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17770 LDKInit ret_var = Init_new(features_arg_conv);
17771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17773 uint64_t ret_ref = (uint64_t)ret_var.inner;
17774 if (ret_var.is_owned) {
17780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17782 orig_conv.inner = (void*)(orig & (~1));
17783 orig_conv.is_owned = false;
17784 LDKInit ret_var = Init_clone(&orig_conv);
17785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17787 uint64_t ret_ref = (uint64_t)ret_var.inner;
17788 if (ret_var.is_owned) {
17794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17795 LDKErrorMessage this_obj_conv;
17796 this_obj_conv.inner = (void*)(this_obj & (~1));
17797 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17798 ErrorMessage_free(this_obj_conv);
17801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17802 LDKErrorMessage this_ptr_conv;
17803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17804 this_ptr_conv.is_owned = false;
17805 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17806 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
17810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17811 LDKErrorMessage this_ptr_conv;
17812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17813 this_ptr_conv.is_owned = false;
17814 LDKThirtyTwoBytes val_ref;
17815 CHECK((*env)->GetArrayLength(env, val) == 32);
17816 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17817 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
17820 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
17821 LDKErrorMessage this_ptr_conv;
17822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17823 this_ptr_conv.is_owned = false;
17824 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
17825 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
17830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
17831 LDKErrorMessage this_ptr_conv;
17832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17833 this_ptr_conv.is_owned = false;
17834 LDKStr val_conv = java_to_owned_str(env, val);
17835 ErrorMessage_set_data(&this_ptr_conv, val_conv);
17838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
17839 LDKThirtyTwoBytes channel_id_arg_ref;
17840 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17841 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17842 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
17843 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
17844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17846 uint64_t ret_ref = (uint64_t)ret_var.inner;
17847 if (ret_var.is_owned) {
17853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17854 LDKErrorMessage orig_conv;
17855 orig_conv.inner = (void*)(orig & (~1));
17856 orig_conv.is_owned = false;
17857 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
17858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17860 uint64_t ret_ref = (uint64_t)ret_var.inner;
17861 if (ret_var.is_owned) {
17867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17868 LDKPing this_obj_conv;
17869 this_obj_conv.inner = (void*)(this_obj & (~1));
17870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17871 Ping_free(this_obj_conv);
17874 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17875 LDKPing this_ptr_conv;
17876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17877 this_ptr_conv.is_owned = false;
17878 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17883 LDKPing this_ptr_conv;
17884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17885 this_ptr_conv.is_owned = false;
17886 Ping_set_ponglen(&this_ptr_conv, val);
17889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17890 LDKPing this_ptr_conv;
17891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17892 this_ptr_conv.is_owned = false;
17893 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17898 LDKPing this_ptr_conv;
17899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17900 this_ptr_conv.is_owned = false;
17901 Ping_set_byteslen(&this_ptr_conv, val);
17904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
17905 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17908 uint64_t ret_ref = (uint64_t)ret_var.inner;
17909 if (ret_var.is_owned) {
17915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17917 orig_conv.inner = (void*)(orig & (~1));
17918 orig_conv.is_owned = false;
17919 LDKPing ret_var = Ping_clone(&orig_conv);
17920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17922 uint64_t ret_ref = (uint64_t)ret_var.inner;
17923 if (ret_var.is_owned) {
17929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17930 LDKPong this_obj_conv;
17931 this_obj_conv.inner = (void*)(this_obj & (~1));
17932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17933 Pong_free(this_obj_conv);
17936 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17937 LDKPong this_ptr_conv;
17938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17939 this_ptr_conv.is_owned = false;
17940 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17945 LDKPong this_ptr_conv;
17946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17947 this_ptr_conv.is_owned = false;
17948 Pong_set_byteslen(&this_ptr_conv, val);
17951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
17952 LDKPong ret_var = Pong_new(byteslen_arg);
17953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17955 uint64_t ret_ref = (uint64_t)ret_var.inner;
17956 if (ret_var.is_owned) {
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17964 orig_conv.inner = (void*)(orig & (~1));
17965 orig_conv.is_owned = false;
17966 LDKPong ret_var = Pong_clone(&orig_conv);
17967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17969 uint64_t ret_ref = (uint64_t)ret_var.inner;
17970 if (ret_var.is_owned) {
17976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17977 LDKOpenChannel this_obj_conv;
17978 this_obj_conv.inner = (void*)(this_obj & (~1));
17979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17980 OpenChannel_free(this_obj_conv);
17983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17984 LDKOpenChannel this_ptr_conv;
17985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17986 this_ptr_conv.is_owned = false;
17987 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17988 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
17992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17993 LDKOpenChannel this_ptr_conv;
17994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17995 this_ptr_conv.is_owned = false;
17996 LDKThirtyTwoBytes val_ref;
17997 CHECK((*env)->GetArrayLength(env, val) == 32);
17998 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17999 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
18002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18003 LDKOpenChannel this_ptr_conv;
18004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18005 this_ptr_conv.is_owned = false;
18006 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18007 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
18011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18012 LDKOpenChannel this_ptr_conv;
18013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18014 this_ptr_conv.is_owned = false;
18015 LDKThirtyTwoBytes val_ref;
18016 CHECK((*env)->GetArrayLength(env, val) == 32);
18017 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18018 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18022 LDKOpenChannel this_ptr_conv;
18023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18024 this_ptr_conv.is_owned = false;
18025 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
18029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18030 LDKOpenChannel this_ptr_conv;
18031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18032 this_ptr_conv.is_owned = false;
18033 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
18036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18037 LDKOpenChannel this_ptr_conv;
18038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18039 this_ptr_conv.is_owned = false;
18040 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
18044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18045 LDKOpenChannel this_ptr_conv;
18046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18047 this_ptr_conv.is_owned = false;
18048 OpenChannel_set_push_msat(&this_ptr_conv, val);
18051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18052 LDKOpenChannel this_ptr_conv;
18053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18054 this_ptr_conv.is_owned = false;
18055 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
18059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18060 LDKOpenChannel this_ptr_conv;
18061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18062 this_ptr_conv.is_owned = false;
18063 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18066 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) {
18067 LDKOpenChannel this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18074 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) {
18075 LDKOpenChannel this_ptr_conv;
18076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18077 this_ptr_conv.is_owned = false;
18078 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18082 LDKOpenChannel this_ptr_conv;
18083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18084 this_ptr_conv.is_owned = false;
18085 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18090 LDKOpenChannel this_ptr_conv;
18091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18092 this_ptr_conv.is_owned = false;
18093 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18097 LDKOpenChannel this_ptr_conv;
18098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18099 this_ptr_conv.is_owned = false;
18100 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
18104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18105 LDKOpenChannel this_ptr_conv;
18106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18107 this_ptr_conv.is_owned = false;
18108 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18111 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
18112 LDKOpenChannel this_ptr_conv;
18113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18114 this_ptr_conv.is_owned = false;
18115 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
18119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18120 LDKOpenChannel this_ptr_conv;
18121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18122 this_ptr_conv.is_owned = false;
18123 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
18126 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18127 LDKOpenChannel this_ptr_conv;
18128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18129 this_ptr_conv.is_owned = false;
18130 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
18134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18135 LDKOpenChannel this_ptr_conv;
18136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18137 this_ptr_conv.is_owned = false;
18138 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
18141 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
18142 LDKOpenChannel this_ptr_conv;
18143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18144 this_ptr_conv.is_owned = false;
18145 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
18149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18150 LDKOpenChannel this_ptr_conv;
18151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18152 this_ptr_conv.is_owned = false;
18153 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18157 LDKOpenChannel this_ptr_conv;
18158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18159 this_ptr_conv.is_owned = false;
18160 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18161 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
18165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18166 LDKOpenChannel this_ptr_conv;
18167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18168 this_ptr_conv.is_owned = false;
18169 LDKPublicKey val_ref;
18170 CHECK((*env)->GetArrayLength(env, val) == 33);
18171 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18172 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18176 LDKOpenChannel 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, 33);
18180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
18184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18185 LDKOpenChannel this_ptr_conv;
18186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18187 this_ptr_conv.is_owned = false;
18188 LDKPublicKey val_ref;
18189 CHECK((*env)->GetArrayLength(env, val) == 33);
18190 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18191 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18195 LDKOpenChannel 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, 33);
18199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
18203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18204 LDKOpenChannel this_ptr_conv;
18205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18206 this_ptr_conv.is_owned = false;
18207 LDKPublicKey val_ref;
18208 CHECK((*env)->GetArrayLength(env, val) == 33);
18209 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18210 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
18213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18214 LDKOpenChannel 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, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
18222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18223 LDKOpenChannel 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 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18233 LDKOpenChannel this_ptr_conv;
18234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18235 this_ptr_conv.is_owned = false;
18236 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
18241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18242 LDKOpenChannel this_ptr_conv;
18243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18244 this_ptr_conv.is_owned = false;
18245 LDKPublicKey val_ref;
18246 CHECK((*env)->GetArrayLength(env, val) == 33);
18247 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18248 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18252 LDKOpenChannel this_ptr_conv;
18253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18254 this_ptr_conv.is_owned = false;
18255 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18256 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
18260 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) {
18261 LDKOpenChannel this_ptr_conv;
18262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18263 this_ptr_conv.is_owned = false;
18264 LDKPublicKey val_ref;
18265 CHECK((*env)->GetArrayLength(env, val) == 33);
18266 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18267 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18270 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18271 LDKOpenChannel this_ptr_conv;
18272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18273 this_ptr_conv.is_owned = false;
18274 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
18278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18279 LDKOpenChannel this_ptr_conv;
18280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18281 this_ptr_conv.is_owned = false;
18282 OpenChannel_set_channel_flags(&this_ptr_conv, val);
18285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18286 LDKOpenChannel orig_conv;
18287 orig_conv.inner = (void*)(orig & (~1));
18288 orig_conv.is_owned = false;
18289 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
18290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18292 uint64_t ret_ref = (uint64_t)ret_var.inner;
18293 if (ret_var.is_owned) {
18299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18300 LDKAcceptChannel this_obj_conv;
18301 this_obj_conv.inner = (void*)(this_obj & (~1));
18302 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18303 AcceptChannel_free(this_obj_conv);
18306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18307 LDKAcceptChannel this_ptr_conv;
18308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18309 this_ptr_conv.is_owned = false;
18310 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18311 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
18315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18316 LDKAcceptChannel this_ptr_conv;
18317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18318 this_ptr_conv.is_owned = false;
18319 LDKThirtyTwoBytes val_ref;
18320 CHECK((*env)->GetArrayLength(env, val) == 32);
18321 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18322 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18326 LDKAcceptChannel this_ptr_conv;
18327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18328 this_ptr_conv.is_owned = false;
18329 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
18333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18334 LDKAcceptChannel this_ptr_conv;
18335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18336 this_ptr_conv.is_owned = false;
18337 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18340 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) {
18341 LDKAcceptChannel this_ptr_conv;
18342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18343 this_ptr_conv.is_owned = false;
18344 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18348 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) {
18349 LDKAcceptChannel this_ptr_conv;
18350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18351 this_ptr_conv.is_owned = false;
18352 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18356 LDKAcceptChannel this_ptr_conv;
18357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18358 this_ptr_conv.is_owned = false;
18359 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18364 LDKAcceptChannel this_ptr_conv;
18365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18366 this_ptr_conv.is_owned = false;
18367 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18371 LDKAcceptChannel this_ptr_conv;
18372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18373 this_ptr_conv.is_owned = false;
18374 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
18378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18379 LDKAcceptChannel this_ptr_conv;
18380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18381 this_ptr_conv.is_owned = false;
18382 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18385 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
18386 LDKAcceptChannel this_ptr_conv;
18387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18388 this_ptr_conv.is_owned = false;
18389 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
18393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18394 LDKAcceptChannel this_ptr_conv;
18395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18396 this_ptr_conv.is_owned = false;
18397 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
18400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18401 LDKAcceptChannel this_ptr_conv;
18402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18403 this_ptr_conv.is_owned = false;
18404 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
18408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18409 LDKAcceptChannel this_ptr_conv;
18410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18411 this_ptr_conv.is_owned = false;
18412 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
18415 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
18416 LDKAcceptChannel this_ptr_conv;
18417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18418 this_ptr_conv.is_owned = false;
18419 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
18423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18424 LDKAcceptChannel this_ptr_conv;
18425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18426 this_ptr_conv.is_owned = false;
18427 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18431 LDKAcceptChannel this_ptr_conv;
18432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18433 this_ptr_conv.is_owned = false;
18434 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
18439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18440 LDKAcceptChannel this_ptr_conv;
18441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18442 this_ptr_conv.is_owned = false;
18443 LDKPublicKey val_ref;
18444 CHECK((*env)->GetArrayLength(env, val) == 33);
18445 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18446 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18450 LDKAcceptChannel this_ptr_conv;
18451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18452 this_ptr_conv.is_owned = false;
18453 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
18458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18459 LDKAcceptChannel this_ptr_conv;
18460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18461 this_ptr_conv.is_owned = false;
18462 LDKPublicKey val_ref;
18463 CHECK((*env)->GetArrayLength(env, val) == 33);
18464 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18465 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18469 LDKAcceptChannel this_ptr_conv;
18470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18471 this_ptr_conv.is_owned = false;
18472 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
18477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18478 LDKAcceptChannel this_ptr_conv;
18479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18480 this_ptr_conv.is_owned = false;
18481 LDKPublicKey val_ref;
18482 CHECK((*env)->GetArrayLength(env, val) == 33);
18483 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18484 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
18487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18488 LDKAcceptChannel this_ptr_conv;
18489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18490 this_ptr_conv.is_owned = false;
18491 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
18496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18497 LDKAcceptChannel this_ptr_conv;
18498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18499 this_ptr_conv.is_owned = false;
18500 LDKPublicKey val_ref;
18501 CHECK((*env)->GetArrayLength(env, val) == 33);
18502 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18503 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18507 LDKAcceptChannel this_ptr_conv;
18508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18509 this_ptr_conv.is_owned = false;
18510 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18511 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
18515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18516 LDKAcceptChannel this_ptr_conv;
18517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18518 this_ptr_conv.is_owned = false;
18519 LDKPublicKey val_ref;
18520 CHECK((*env)->GetArrayLength(env, val) == 33);
18521 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18522 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18526 LDKAcceptChannel this_ptr_conv;
18527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18528 this_ptr_conv.is_owned = false;
18529 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18530 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
18534 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) {
18535 LDKAcceptChannel this_ptr_conv;
18536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18537 this_ptr_conv.is_owned = false;
18538 LDKPublicKey val_ref;
18539 CHECK((*env)->GetArrayLength(env, val) == 33);
18540 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18541 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18545 LDKAcceptChannel orig_conv;
18546 orig_conv.inner = (void*)(orig & (~1));
18547 orig_conv.is_owned = false;
18548 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
18549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18551 uint64_t ret_ref = (uint64_t)ret_var.inner;
18552 if (ret_var.is_owned) {
18558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18559 LDKFundingCreated this_obj_conv;
18560 this_obj_conv.inner = (void*)(this_obj & (~1));
18561 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18562 FundingCreated_free(this_obj_conv);
18565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18566 LDKFundingCreated this_ptr_conv;
18567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18568 this_ptr_conv.is_owned = false;
18569 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18570 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
18574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18575 LDKFundingCreated this_ptr_conv;
18576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18577 this_ptr_conv.is_owned = false;
18578 LDKThirtyTwoBytes val_ref;
18579 CHECK((*env)->GetArrayLength(env, val) == 32);
18580 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18581 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
18584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18585 LDKFundingCreated this_ptr_conv;
18586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18587 this_ptr_conv.is_owned = false;
18588 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
18593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18594 LDKFundingCreated this_ptr_conv;
18595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18596 this_ptr_conv.is_owned = false;
18597 LDKThirtyTwoBytes val_ref;
18598 CHECK((*env)->GetArrayLength(env, val) == 32);
18599 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18600 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
18603 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
18604 LDKFundingCreated this_ptr_conv;
18605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18606 this_ptr_conv.is_owned = false;
18607 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
18611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18612 LDKFundingCreated this_ptr_conv;
18613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18614 this_ptr_conv.is_owned = false;
18615 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
18618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18619 LDKFundingCreated this_ptr_conv;
18620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18621 this_ptr_conv.is_owned = false;
18622 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18623 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
18627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18628 LDKFundingCreated this_ptr_conv;
18629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18630 this_ptr_conv.is_owned = false;
18631 LDKSignature val_ref;
18632 CHECK((*env)->GetArrayLength(env, val) == 64);
18633 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18634 FundingCreated_set_signature(&this_ptr_conv, val_ref);
18637 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) {
18638 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
18639 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
18640 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
18641 LDKThirtyTwoBytes funding_txid_arg_ref;
18642 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
18643 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
18644 LDKSignature signature_arg_ref;
18645 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18646 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18647 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
18648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18650 uint64_t ret_ref = (uint64_t)ret_var.inner;
18651 if (ret_var.is_owned) {
18657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18658 LDKFundingCreated orig_conv;
18659 orig_conv.inner = (void*)(orig & (~1));
18660 orig_conv.is_owned = false;
18661 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
18662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18664 uint64_t ret_ref = (uint64_t)ret_var.inner;
18665 if (ret_var.is_owned) {
18671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18672 LDKFundingSigned this_obj_conv;
18673 this_obj_conv.inner = (void*)(this_obj & (~1));
18674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18675 FundingSigned_free(this_obj_conv);
18678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18679 LDKFundingSigned this_ptr_conv;
18680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18681 this_ptr_conv.is_owned = false;
18682 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18683 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
18687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18688 LDKFundingSigned this_ptr_conv;
18689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18690 this_ptr_conv.is_owned = false;
18691 LDKThirtyTwoBytes val_ref;
18692 CHECK((*env)->GetArrayLength(env, val) == 32);
18693 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18694 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
18697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18698 LDKFundingSigned this_ptr_conv;
18699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18700 this_ptr_conv.is_owned = false;
18701 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18702 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
18706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18707 LDKFundingSigned this_ptr_conv;
18708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18709 this_ptr_conv.is_owned = false;
18710 LDKSignature val_ref;
18711 CHECK((*env)->GetArrayLength(env, val) == 64);
18712 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18713 FundingSigned_set_signature(&this_ptr_conv, val_ref);
18716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
18717 LDKThirtyTwoBytes channel_id_arg_ref;
18718 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18719 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18720 LDKSignature signature_arg_ref;
18721 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18722 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18723 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
18724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18726 uint64_t ret_ref = (uint64_t)ret_var.inner;
18727 if (ret_var.is_owned) {
18733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18734 LDKFundingSigned orig_conv;
18735 orig_conv.inner = (void*)(orig & (~1));
18736 orig_conv.is_owned = false;
18737 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
18738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18740 uint64_t ret_ref = (uint64_t)ret_var.inner;
18741 if (ret_var.is_owned) {
18747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18748 LDKFundingLocked this_obj_conv;
18749 this_obj_conv.inner = (void*)(this_obj & (~1));
18750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18751 FundingLocked_free(this_obj_conv);
18754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18755 LDKFundingLocked this_ptr_conv;
18756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18757 this_ptr_conv.is_owned = false;
18758 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18759 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
18763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18764 LDKFundingLocked this_ptr_conv;
18765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18766 this_ptr_conv.is_owned = false;
18767 LDKThirtyTwoBytes val_ref;
18768 CHECK((*env)->GetArrayLength(env, val) == 32);
18769 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18770 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
18773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18774 LDKFundingLocked this_ptr_conv;
18775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18776 this_ptr_conv.is_owned = false;
18777 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18778 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18782 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) {
18783 LDKFundingLocked this_ptr_conv;
18784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18785 this_ptr_conv.is_owned = false;
18786 LDKPublicKey val_ref;
18787 CHECK((*env)->GetArrayLength(env, val) == 33);
18788 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18789 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18792 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) {
18793 LDKThirtyTwoBytes channel_id_arg_ref;
18794 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18795 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18796 LDKPublicKey next_per_commitment_point_arg_ref;
18797 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18798 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18799 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
18800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18802 uint64_t ret_ref = (uint64_t)ret_var.inner;
18803 if (ret_var.is_owned) {
18809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18810 LDKFundingLocked orig_conv;
18811 orig_conv.inner = (void*)(orig & (~1));
18812 orig_conv.is_owned = false;
18813 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
18814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18816 uint64_t ret_ref = (uint64_t)ret_var.inner;
18817 if (ret_var.is_owned) {
18823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18824 LDKShutdown this_obj_conv;
18825 this_obj_conv.inner = (void*)(this_obj & (~1));
18826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18827 Shutdown_free(this_obj_conv);
18830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18831 LDKShutdown this_ptr_conv;
18832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18833 this_ptr_conv.is_owned = false;
18834 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
18839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18840 LDKShutdown this_ptr_conv;
18841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18842 this_ptr_conv.is_owned = false;
18843 LDKThirtyTwoBytes val_ref;
18844 CHECK((*env)->GetArrayLength(env, val) == 32);
18845 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18846 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
18849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18850 LDKShutdown this_ptr_conv;
18851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18852 this_ptr_conv.is_owned = false;
18853 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
18854 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18855 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18860 LDKShutdown this_ptr_conv;
18861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18862 this_ptr_conv.is_owned = false;
18863 LDKCVec_u8Z val_ref;
18864 val_ref.datalen = (*env)->GetArrayLength(env, val);
18865 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18866 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18867 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18871 LDKThirtyTwoBytes channel_id_arg_ref;
18872 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18873 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18874 LDKCVec_u8Z scriptpubkey_arg_ref;
18875 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
18876 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18877 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
18878 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18879 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18880 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18881 uint64_t ret_ref = (uint64_t)ret_var.inner;
18882 if (ret_var.is_owned) {
18888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18889 LDKShutdown orig_conv;
18890 orig_conv.inner = (void*)(orig & (~1));
18891 orig_conv.is_owned = false;
18892 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18895 uint64_t ret_ref = (uint64_t)ret_var.inner;
18896 if (ret_var.is_owned) {
18902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18903 LDKClosingSignedFeeRange this_obj_conv;
18904 this_obj_conv.inner = (void*)(this_obj & (~1));
18905 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18906 ClosingSignedFeeRange_free(this_obj_conv);
18909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18910 LDKClosingSignedFeeRange this_ptr_conv;
18911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18912 this_ptr_conv.is_owned = false;
18913 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
18917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18918 LDKClosingSignedFeeRange this_ptr_conv;
18919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18920 this_ptr_conv.is_owned = false;
18921 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
18924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18925 LDKClosingSignedFeeRange this_ptr_conv;
18926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18927 this_ptr_conv.is_owned = false;
18928 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
18932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18933 LDKClosingSignedFeeRange this_ptr_conv;
18934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18935 this_ptr_conv.is_owned = false;
18936 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
18939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
18940 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
18941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18943 uint64_t ret_ref = (uint64_t)ret_var.inner;
18944 if (ret_var.is_owned) {
18950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18951 LDKClosingSignedFeeRange orig_conv;
18952 orig_conv.inner = (void*)(orig & (~1));
18953 orig_conv.is_owned = false;
18954 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
18955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18957 uint64_t ret_ref = (uint64_t)ret_var.inner;
18958 if (ret_var.is_owned) {
18964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18965 LDKClosingSigned this_obj_conv;
18966 this_obj_conv.inner = (void*)(this_obj & (~1));
18967 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18968 ClosingSigned_free(this_obj_conv);
18971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18972 LDKClosingSigned this_ptr_conv;
18973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18974 this_ptr_conv.is_owned = false;
18975 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
18980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18981 LDKClosingSigned this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 LDKThirtyTwoBytes val_ref;
18985 CHECK((*env)->GetArrayLength(env, val) == 32);
18986 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18987 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18991 LDKClosingSigned this_ptr_conv;
18992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18993 this_ptr_conv.is_owned = false;
18994 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
18998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18999 LDKClosingSigned this_ptr_conv;
19000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19001 this_ptr_conv.is_owned = false;
19002 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
19005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19006 LDKClosingSigned this_ptr_conv;
19007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19008 this_ptr_conv.is_owned = false;
19009 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19010 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
19014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19015 LDKClosingSigned this_ptr_conv;
19016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19017 this_ptr_conv.is_owned = false;
19018 LDKSignature val_ref;
19019 CHECK((*env)->GetArrayLength(env, val) == 64);
19020 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19021 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
19024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19025 LDKClosingSigned this_ptr_conv;
19026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19027 this_ptr_conv.is_owned = false;
19028 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
19029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19031 uint64_t ret_ref = (uint64_t)ret_var.inner;
19032 if (ret_var.is_owned) {
19038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19039 LDKClosingSigned this_ptr_conv;
19040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19041 this_ptr_conv.is_owned = false;
19042 LDKClosingSignedFeeRange val_conv;
19043 val_conv.inner = (void*)(val & (~1));
19044 val_conv.is_owned = (val & 1) || (val == 0);
19045 val_conv = ClosingSignedFeeRange_clone(&val_conv);
19046 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
19049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
19050 LDKThirtyTwoBytes channel_id_arg_ref;
19051 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19052 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19053 LDKSignature signature_arg_ref;
19054 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19055 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19056 LDKClosingSignedFeeRange fee_range_arg_conv;
19057 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
19058 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
19059 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
19060 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
19061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19063 uint64_t ret_ref = (uint64_t)ret_var.inner;
19064 if (ret_var.is_owned) {
19070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19071 LDKClosingSigned orig_conv;
19072 orig_conv.inner = (void*)(orig & (~1));
19073 orig_conv.is_owned = false;
19074 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
19075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19077 uint64_t ret_ref = (uint64_t)ret_var.inner;
19078 if (ret_var.is_owned) {
19084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19085 LDKUpdateAddHTLC this_obj_conv;
19086 this_obj_conv.inner = (void*)(this_obj & (~1));
19087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19088 UpdateAddHTLC_free(this_obj_conv);
19091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19092 LDKUpdateAddHTLC this_ptr_conv;
19093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19094 this_ptr_conv.is_owned = false;
19095 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19096 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
19100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19101 LDKUpdateAddHTLC this_ptr_conv;
19102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19103 this_ptr_conv.is_owned = false;
19104 LDKThirtyTwoBytes val_ref;
19105 CHECK((*env)->GetArrayLength(env, val) == 32);
19106 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19107 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
19110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19111 LDKUpdateAddHTLC this_ptr_conv;
19112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19113 this_ptr_conv.is_owned = false;
19114 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
19118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19119 LDKUpdateAddHTLC this_ptr_conv;
19120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19121 this_ptr_conv.is_owned = false;
19122 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
19125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19126 LDKUpdateAddHTLC this_ptr_conv;
19127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19128 this_ptr_conv.is_owned = false;
19129 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
19133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19134 LDKUpdateAddHTLC this_ptr_conv;
19135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19136 this_ptr_conv.is_owned = false;
19137 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
19140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19141 LDKUpdateAddHTLC this_ptr_conv;
19142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19143 this_ptr_conv.is_owned = false;
19144 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
19149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19150 LDKUpdateAddHTLC this_ptr_conv;
19151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19152 this_ptr_conv.is_owned = false;
19153 LDKThirtyTwoBytes val_ref;
19154 CHECK((*env)->GetArrayLength(env, val) == 32);
19155 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19156 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
19159 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
19160 LDKUpdateAddHTLC this_ptr_conv;
19161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19162 this_ptr_conv.is_owned = false;
19163 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
19167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19168 LDKUpdateAddHTLC this_ptr_conv;
19169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19170 this_ptr_conv.is_owned = false;
19171 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
19174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19175 LDKUpdateAddHTLC orig_conv;
19176 orig_conv.inner = (void*)(orig & (~1));
19177 orig_conv.is_owned = false;
19178 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
19179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19181 uint64_t ret_ref = (uint64_t)ret_var.inner;
19182 if (ret_var.is_owned) {
19188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19189 LDKUpdateFulfillHTLC this_obj_conv;
19190 this_obj_conv.inner = (void*)(this_obj & (~1));
19191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19192 UpdateFulfillHTLC_free(this_obj_conv);
19195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19196 LDKUpdateFulfillHTLC this_ptr_conv;
19197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19198 this_ptr_conv.is_owned = false;
19199 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
19204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19205 LDKUpdateFulfillHTLC this_ptr_conv;
19206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19207 this_ptr_conv.is_owned = false;
19208 LDKThirtyTwoBytes val_ref;
19209 CHECK((*env)->GetArrayLength(env, val) == 32);
19210 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19211 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
19214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19215 LDKUpdateFulfillHTLC this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
19222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19223 LDKUpdateFulfillHTLC this_ptr_conv;
19224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19225 this_ptr_conv.is_owned = false;
19226 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
19229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
19230 LDKUpdateFulfillHTLC this_ptr_conv;
19231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19232 this_ptr_conv.is_owned = false;
19233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
19238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19239 LDKUpdateFulfillHTLC this_ptr_conv;
19240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19241 this_ptr_conv.is_owned = false;
19242 LDKThirtyTwoBytes val_ref;
19243 CHECK((*env)->GetArrayLength(env, val) == 32);
19244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19245 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
19248 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) {
19249 LDKThirtyTwoBytes channel_id_arg_ref;
19250 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19251 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19252 LDKThirtyTwoBytes payment_preimage_arg_ref;
19253 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
19254 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
19255 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
19256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19258 uint64_t ret_ref = (uint64_t)ret_var.inner;
19259 if (ret_var.is_owned) {
19265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19266 LDKUpdateFulfillHTLC orig_conv;
19267 orig_conv.inner = (void*)(orig & (~1));
19268 orig_conv.is_owned = false;
19269 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
19270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19272 uint64_t ret_ref = (uint64_t)ret_var.inner;
19273 if (ret_var.is_owned) {
19279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19280 LDKUpdateFailHTLC this_obj_conv;
19281 this_obj_conv.inner = (void*)(this_obj & (~1));
19282 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19283 UpdateFailHTLC_free(this_obj_conv);
19286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19287 LDKUpdateFailHTLC this_ptr_conv;
19288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19289 this_ptr_conv.is_owned = false;
19290 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
19295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19296 LDKUpdateFailHTLC this_ptr_conv;
19297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19298 this_ptr_conv.is_owned = false;
19299 LDKThirtyTwoBytes val_ref;
19300 CHECK((*env)->GetArrayLength(env, val) == 32);
19301 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19302 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
19305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19306 LDKUpdateFailHTLC this_ptr_conv;
19307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19308 this_ptr_conv.is_owned = false;
19309 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
19313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19314 LDKUpdateFailHTLC this_ptr_conv;
19315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19316 this_ptr_conv.is_owned = false;
19317 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
19320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19321 LDKUpdateFailHTLC orig_conv;
19322 orig_conv.inner = (void*)(orig & (~1));
19323 orig_conv.is_owned = false;
19324 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
19325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19327 uint64_t ret_ref = (uint64_t)ret_var.inner;
19328 if (ret_var.is_owned) {
19334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19335 LDKUpdateFailMalformedHTLC this_obj_conv;
19336 this_obj_conv.inner = (void*)(this_obj & (~1));
19337 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19338 UpdateFailMalformedHTLC_free(this_obj_conv);
19341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19342 LDKUpdateFailMalformedHTLC this_ptr_conv;
19343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19344 this_ptr_conv.is_owned = false;
19345 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19346 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
19350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19351 LDKUpdateFailMalformedHTLC this_ptr_conv;
19352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19353 this_ptr_conv.is_owned = false;
19354 LDKThirtyTwoBytes val_ref;
19355 CHECK((*env)->GetArrayLength(env, val) == 32);
19356 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19357 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
19360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19361 LDKUpdateFailMalformedHTLC this_ptr_conv;
19362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19363 this_ptr_conv.is_owned = false;
19364 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
19368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19369 LDKUpdateFailMalformedHTLC this_ptr_conv;
19370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19371 this_ptr_conv.is_owned = false;
19372 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
19375 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
19376 LDKUpdateFailMalformedHTLC this_ptr_conv;
19377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19378 this_ptr_conv.is_owned = false;
19379 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
19383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19384 LDKUpdateFailMalformedHTLC this_ptr_conv;
19385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19386 this_ptr_conv.is_owned = false;
19387 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
19390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19391 LDKUpdateFailMalformedHTLC orig_conv;
19392 orig_conv.inner = (void*)(orig & (~1));
19393 orig_conv.is_owned = false;
19394 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
19395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19397 uint64_t ret_ref = (uint64_t)ret_var.inner;
19398 if (ret_var.is_owned) {
19404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19405 LDKCommitmentSigned this_obj_conv;
19406 this_obj_conv.inner = (void*)(this_obj & (~1));
19407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19408 CommitmentSigned_free(this_obj_conv);
19411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19412 LDKCommitmentSigned this_ptr_conv;
19413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19414 this_ptr_conv.is_owned = false;
19415 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
19420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19421 LDKCommitmentSigned this_ptr_conv;
19422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19423 this_ptr_conv.is_owned = false;
19424 LDKThirtyTwoBytes val_ref;
19425 CHECK((*env)->GetArrayLength(env, val) == 32);
19426 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19427 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
19430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19431 LDKCommitmentSigned this_ptr_conv;
19432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19433 this_ptr_conv.is_owned = false;
19434 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
19439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19440 LDKCommitmentSigned this_ptr_conv;
19441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19442 this_ptr_conv.is_owned = false;
19443 LDKSignature val_ref;
19444 CHECK((*env)->GetArrayLength(env, val) == 64);
19445 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19446 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
19449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
19450 LDKCommitmentSigned this_ptr_conv;
19451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19452 this_ptr_conv.is_owned = false;
19453 LDKCVec_SignatureZ val_constr;
19454 val_constr.datalen = (*env)->GetArrayLength(env, val);
19455 if (val_constr.datalen > 0)
19456 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19458 val_constr.data = NULL;
19459 for (size_t i = 0; i < val_constr.datalen; i++) {
19460 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
19461 LDKSignature val_conv_8_ref;
19462 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
19463 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
19464 val_constr.data[i] = val_conv_8_ref;
19466 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
19469 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) {
19470 LDKThirtyTwoBytes channel_id_arg_ref;
19471 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19472 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19473 LDKSignature signature_arg_ref;
19474 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19475 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19476 LDKCVec_SignatureZ htlc_signatures_arg_constr;
19477 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
19478 if (htlc_signatures_arg_constr.datalen > 0)
19479 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19481 htlc_signatures_arg_constr.data = NULL;
19482 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
19483 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
19484 LDKSignature htlc_signatures_arg_conv_8_ref;
19485 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
19486 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
19487 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
19489 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
19490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19492 uint64_t ret_ref = (uint64_t)ret_var.inner;
19493 if (ret_var.is_owned) {
19499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19500 LDKCommitmentSigned orig_conv;
19501 orig_conv.inner = (void*)(orig & (~1));
19502 orig_conv.is_owned = false;
19503 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
19504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19506 uint64_t ret_ref = (uint64_t)ret_var.inner;
19507 if (ret_var.is_owned) {
19513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19514 LDKRevokeAndACK this_obj_conv;
19515 this_obj_conv.inner = (void*)(this_obj & (~1));
19516 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19517 RevokeAndACK_free(this_obj_conv);
19520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19521 LDKRevokeAndACK this_ptr_conv;
19522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19523 this_ptr_conv.is_owned = false;
19524 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
19529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19530 LDKRevokeAndACK this_ptr_conv;
19531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19532 this_ptr_conv.is_owned = false;
19533 LDKThirtyTwoBytes val_ref;
19534 CHECK((*env)->GetArrayLength(env, val) == 32);
19535 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19536 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
19539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
19540 LDKRevokeAndACK this_ptr_conv;
19541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19542 this_ptr_conv.is_owned = false;
19543 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
19548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19549 LDKRevokeAndACK this_ptr_conv;
19550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19551 this_ptr_conv.is_owned = false;
19552 LDKThirtyTwoBytes val_ref;
19553 CHECK((*env)->GetArrayLength(env, val) == 32);
19554 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19555 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
19558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19559 LDKRevokeAndACK this_ptr_conv;
19560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19561 this_ptr_conv.is_owned = false;
19562 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19563 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
19567 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) {
19568 LDKRevokeAndACK this_ptr_conv;
19569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19570 this_ptr_conv.is_owned = false;
19571 LDKPublicKey val_ref;
19572 CHECK((*env)->GetArrayLength(env, val) == 33);
19573 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19574 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
19577 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) {
19578 LDKThirtyTwoBytes channel_id_arg_ref;
19579 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19580 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19581 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
19582 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
19583 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
19584 LDKPublicKey next_per_commitment_point_arg_ref;
19585 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
19586 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
19587 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
19588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19590 uint64_t ret_ref = (uint64_t)ret_var.inner;
19591 if (ret_var.is_owned) {
19597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19598 LDKRevokeAndACK orig_conv;
19599 orig_conv.inner = (void*)(orig & (~1));
19600 orig_conv.is_owned = false;
19601 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
19602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19604 uint64_t ret_ref = (uint64_t)ret_var.inner;
19605 if (ret_var.is_owned) {
19611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19612 LDKUpdateFee this_obj_conv;
19613 this_obj_conv.inner = (void*)(this_obj & (~1));
19614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19615 UpdateFee_free(this_obj_conv);
19618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19619 LDKUpdateFee this_ptr_conv;
19620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19621 this_ptr_conv.is_owned = false;
19622 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19623 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
19627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19628 LDKUpdateFee this_ptr_conv;
19629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19630 this_ptr_conv.is_owned = false;
19631 LDKThirtyTwoBytes val_ref;
19632 CHECK((*env)->GetArrayLength(env, val) == 32);
19633 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19634 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
19637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
19638 LDKUpdateFee this_ptr_conv;
19639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19640 this_ptr_conv.is_owned = false;
19641 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
19645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19646 LDKUpdateFee this_ptr_conv;
19647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19648 this_ptr_conv.is_owned = false;
19649 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
19652 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) {
19653 LDKThirtyTwoBytes channel_id_arg_ref;
19654 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19655 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19656 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
19657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19659 uint64_t ret_ref = (uint64_t)ret_var.inner;
19660 if (ret_var.is_owned) {
19666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19667 LDKUpdateFee orig_conv;
19668 orig_conv.inner = (void*)(orig & (~1));
19669 orig_conv.is_owned = false;
19670 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
19671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19673 uint64_t ret_ref = (uint64_t)ret_var.inner;
19674 if (ret_var.is_owned) {
19680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19681 LDKDataLossProtect this_obj_conv;
19682 this_obj_conv.inner = (void*)(this_obj & (~1));
19683 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19684 DataLossProtect_free(this_obj_conv);
19687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
19688 LDKDataLossProtect this_ptr_conv;
19689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19690 this_ptr_conv.is_owned = false;
19691 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
19696 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) {
19697 LDKDataLossProtect this_ptr_conv;
19698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19699 this_ptr_conv.is_owned = false;
19700 LDKThirtyTwoBytes val_ref;
19701 CHECK((*env)->GetArrayLength(env, val) == 32);
19702 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19703 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
19706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19707 LDKDataLossProtect this_ptr_conv;
19708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19709 this_ptr_conv.is_owned = false;
19710 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
19715 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) {
19716 LDKDataLossProtect this_ptr_conv;
19717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19718 this_ptr_conv.is_owned = false;
19719 LDKPublicKey val_ref;
19720 CHECK((*env)->GetArrayLength(env, val) == 33);
19721 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19722 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
19725 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) {
19726 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
19727 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
19728 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
19729 LDKPublicKey my_current_per_commitment_point_arg_ref;
19730 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
19731 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
19732 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
19733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19735 uint64_t ret_ref = (uint64_t)ret_var.inner;
19736 if (ret_var.is_owned) {
19742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19743 LDKDataLossProtect orig_conv;
19744 orig_conv.inner = (void*)(orig & (~1));
19745 orig_conv.is_owned = false;
19746 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
19747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19749 uint64_t ret_ref = (uint64_t)ret_var.inner;
19750 if (ret_var.is_owned) {
19756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19757 LDKChannelReestablish this_obj_conv;
19758 this_obj_conv.inner = (void*)(this_obj & (~1));
19759 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19760 ChannelReestablish_free(this_obj_conv);
19763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19764 LDKChannelReestablish this_ptr_conv;
19765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19766 this_ptr_conv.is_owned = false;
19767 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19768 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
19772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19773 LDKChannelReestablish this_ptr_conv;
19774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19775 this_ptr_conv.is_owned = false;
19776 LDKThirtyTwoBytes val_ref;
19777 CHECK((*env)->GetArrayLength(env, val) == 32);
19778 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19779 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
19782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
19783 LDKChannelReestablish this_ptr_conv;
19784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19785 this_ptr_conv.is_owned = false;
19786 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
19790 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) {
19791 LDKChannelReestablish this_ptr_conv;
19792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19793 this_ptr_conv.is_owned = false;
19794 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
19797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
19798 LDKChannelReestablish this_ptr_conv;
19799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19800 this_ptr_conv.is_owned = false;
19801 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
19805 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) {
19806 LDKChannelReestablish this_ptr_conv;
19807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19808 this_ptr_conv.is_owned = false;
19809 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
19812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19813 LDKChannelReestablish orig_conv;
19814 orig_conv.inner = (void*)(orig & (~1));
19815 orig_conv.is_owned = false;
19816 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
19817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19819 uint64_t ret_ref = (uint64_t)ret_var.inner;
19820 if (ret_var.is_owned) {
19826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19827 LDKAnnouncementSignatures this_obj_conv;
19828 this_obj_conv.inner = (void*)(this_obj & (~1));
19829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19830 AnnouncementSignatures_free(this_obj_conv);
19833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19834 LDKAnnouncementSignatures this_ptr_conv;
19835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19836 this_ptr_conv.is_owned = false;
19837 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
19842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19843 LDKAnnouncementSignatures this_ptr_conv;
19844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19845 this_ptr_conv.is_owned = false;
19846 LDKThirtyTwoBytes val_ref;
19847 CHECK((*env)->GetArrayLength(env, val) == 32);
19848 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19849 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
19852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19853 LDKAnnouncementSignatures this_ptr_conv;
19854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19855 this_ptr_conv.is_owned = false;
19856 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
19860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19861 LDKAnnouncementSignatures this_ptr_conv;
19862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19863 this_ptr_conv.is_owned = false;
19864 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19868 LDKAnnouncementSignatures this_ptr_conv;
19869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19870 this_ptr_conv.is_owned = false;
19871 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19872 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
19876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19877 LDKAnnouncementSignatures this_ptr_conv;
19878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19879 this_ptr_conv.is_owned = false;
19880 LDKSignature val_ref;
19881 CHECK((*env)->GetArrayLength(env, val) == 64);
19882 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19883 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19887 LDKAnnouncementSignatures this_ptr_conv;
19888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19889 this_ptr_conv.is_owned = false;
19890 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19891 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
19895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19896 LDKAnnouncementSignatures this_ptr_conv;
19897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19898 this_ptr_conv.is_owned = false;
19899 LDKSignature val_ref;
19900 CHECK((*env)->GetArrayLength(env, val) == 64);
19901 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19902 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19905 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) {
19906 LDKThirtyTwoBytes channel_id_arg_ref;
19907 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19908 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19909 LDKSignature node_signature_arg_ref;
19910 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
19911 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
19912 LDKSignature bitcoin_signature_arg_ref;
19913 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
19914 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
19915 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19918 uint64_t ret_ref = (uint64_t)ret_var.inner;
19919 if (ret_var.is_owned) {
19925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19926 LDKAnnouncementSignatures orig_conv;
19927 orig_conv.inner = (void*)(orig & (~1));
19928 orig_conv.is_owned = false;
19929 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19932 uint64_t ret_ref = (uint64_t)ret_var.inner;
19933 if (ret_var.is_owned) {
19939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19940 if ((this_ptr & 1) != 0) return;
19941 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
19942 FREE((void*)this_ptr);
19943 NetAddress_free(this_ptr_conv);
19946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19947 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19948 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19949 *ret_copy = NetAddress_clone(orig_conv);
19950 uint64_t ret_ref = (uint64_t)ret_copy;
19954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19955 LDKFourBytes addr_ref;
19956 CHECK((*env)->GetArrayLength(env, addr) == 4);
19957 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
19958 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19959 *ret_copy = NetAddress_ipv4(addr_ref, port);
19960 uint64_t ret_ref = (uint64_t)ret_copy;
19964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19965 LDKSixteenBytes addr_ref;
19966 CHECK((*env)->GetArrayLength(env, addr) == 16);
19967 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
19968 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19969 *ret_copy = NetAddress_ipv6(addr_ref, port);
19970 uint64_t ret_ref = (uint64_t)ret_copy;
19974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19975 LDKTenBytes addr_ref;
19976 CHECK((*env)->GetArrayLength(env, addr) == 10);
19977 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
19978 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19979 *ret_copy = NetAddress_onion_v2(addr_ref, port);
19980 uint64_t ret_ref = (uint64_t)ret_copy;
19984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
19985 LDKThirtyTwoBytes ed25519_pubkey_ref;
19986 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
19987 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
19988 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19989 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
19990 uint64_t ret_ref = (uint64_t)ret_copy;
19994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
19995 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19996 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19997 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19998 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19999 CVec_u8Z_free(ret_var);
20003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20004 LDKu8slice ser_ref;
20005 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20006 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20007 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
20008 *ret_conv = Result_read(ser_ref);
20009 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20010 return (uint64_t)ret_conv;
20013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20014 LDKu8slice ser_ref;
20015 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20016 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20017 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20018 *ret_conv = NetAddress_read(ser_ref);
20019 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20020 return (uint64_t)ret_conv;
20023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20024 LDKUnsignedNodeAnnouncement this_obj_conv;
20025 this_obj_conv.inner = (void*)(this_obj & (~1));
20026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20027 UnsignedNodeAnnouncement_free(this_obj_conv);
20030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20031 LDKUnsignedNodeAnnouncement this_ptr_conv;
20032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20033 this_ptr_conv.is_owned = false;
20034 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
20035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20037 uint64_t ret_ref = (uint64_t)ret_var.inner;
20038 if (ret_var.is_owned) {
20044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20045 LDKUnsignedNodeAnnouncement this_ptr_conv;
20046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20047 this_ptr_conv.is_owned = false;
20048 LDKNodeFeatures val_conv;
20049 val_conv.inner = (void*)(val & (~1));
20050 val_conv.is_owned = (val & 1) || (val == 0);
20051 val_conv = NodeFeatures_clone(&val_conv);
20052 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
20055 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
20056 LDKUnsignedNodeAnnouncement this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
20063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20064 LDKUnsignedNodeAnnouncement this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
20070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20071 LDKUnsignedNodeAnnouncement this_ptr_conv;
20072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20073 this_ptr_conv.is_owned = false;
20074 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20075 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
20079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20080 LDKUnsignedNodeAnnouncement this_ptr_conv;
20081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20082 this_ptr_conv.is_owned = false;
20083 LDKPublicKey val_ref;
20084 CHECK((*env)->GetArrayLength(env, val) == 33);
20085 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20086 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
20089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
20090 LDKUnsignedNodeAnnouncement this_ptr_conv;
20091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20092 this_ptr_conv.is_owned = false;
20093 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
20094 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
20098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20099 LDKUnsignedNodeAnnouncement this_ptr_conv;
20100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20101 this_ptr_conv.is_owned = false;
20102 LDKThreeBytes val_ref;
20103 CHECK((*env)->GetArrayLength(env, val) == 3);
20104 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
20105 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
20108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
20109 LDKUnsignedNodeAnnouncement this_ptr_conv;
20110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20111 this_ptr_conv.is_owned = false;
20112 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
20117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20118 LDKUnsignedNodeAnnouncement this_ptr_conv;
20119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20120 this_ptr_conv.is_owned = false;
20121 LDKThirtyTwoBytes val_ref;
20122 CHECK((*env)->GetArrayLength(env, val) == 32);
20123 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20124 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
20127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20128 LDKUnsignedNodeAnnouncement this_ptr_conv;
20129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20130 this_ptr_conv.is_owned = false;
20131 LDKCVec_NetAddressZ val_constr;
20132 val_constr.datalen = (*env)->GetArrayLength(env, val);
20133 if (val_constr.datalen > 0)
20134 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20136 val_constr.data = NULL;
20137 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20138 for (size_t m = 0; m < val_constr.datalen; m++) {
20139 int64_t val_conv_12 = val_vals[m];
20140 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
20141 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
20142 val_constr.data[m] = val_conv_12_conv;
20144 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20145 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
20148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20149 LDKUnsignedNodeAnnouncement orig_conv;
20150 orig_conv.inner = (void*)(orig & (~1));
20151 orig_conv.is_owned = false;
20152 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
20153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20155 uint64_t ret_ref = (uint64_t)ret_var.inner;
20156 if (ret_var.is_owned) {
20162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20163 LDKNodeAnnouncement this_obj_conv;
20164 this_obj_conv.inner = (void*)(this_obj & (~1));
20165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20166 NodeAnnouncement_free(this_obj_conv);
20169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20170 LDKNodeAnnouncement this_ptr_conv;
20171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20172 this_ptr_conv.is_owned = false;
20173 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20174 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
20178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20179 LDKNodeAnnouncement this_ptr_conv;
20180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20181 this_ptr_conv.is_owned = false;
20182 LDKSignature val_ref;
20183 CHECK((*env)->GetArrayLength(env, val) == 64);
20184 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20185 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
20188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20189 LDKNodeAnnouncement this_ptr_conv;
20190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20191 this_ptr_conv.is_owned = false;
20192 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
20193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20195 uint64_t ret_ref = (uint64_t)ret_var.inner;
20196 if (ret_var.is_owned) {
20202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20203 LDKNodeAnnouncement this_ptr_conv;
20204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20205 this_ptr_conv.is_owned = false;
20206 LDKUnsignedNodeAnnouncement val_conv;
20207 val_conv.inner = (void*)(val & (~1));
20208 val_conv.is_owned = (val & 1) || (val == 0);
20209 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
20210 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
20213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
20214 LDKSignature signature_arg_ref;
20215 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20216 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20217 LDKUnsignedNodeAnnouncement contents_arg_conv;
20218 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20219 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20220 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
20221 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
20222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20224 uint64_t ret_ref = (uint64_t)ret_var.inner;
20225 if (ret_var.is_owned) {
20231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20232 LDKNodeAnnouncement orig_conv;
20233 orig_conv.inner = (void*)(orig & (~1));
20234 orig_conv.is_owned = false;
20235 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
20236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20238 uint64_t ret_ref = (uint64_t)ret_var.inner;
20239 if (ret_var.is_owned) {
20245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20246 LDKUnsignedChannelAnnouncement this_obj_conv;
20247 this_obj_conv.inner = (void*)(this_obj & (~1));
20248 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20249 UnsignedChannelAnnouncement_free(this_obj_conv);
20252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20253 LDKUnsignedChannelAnnouncement this_ptr_conv;
20254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20255 this_ptr_conv.is_owned = false;
20256 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
20257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20259 uint64_t ret_ref = (uint64_t)ret_var.inner;
20260 if (ret_var.is_owned) {
20266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20267 LDKUnsignedChannelAnnouncement this_ptr_conv;
20268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20269 this_ptr_conv.is_owned = false;
20270 LDKChannelFeatures val_conv;
20271 val_conv.inner = (void*)(val & (~1));
20272 val_conv.is_owned = (val & 1) || (val == 0);
20273 val_conv = ChannelFeatures_clone(&val_conv);
20274 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
20277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20278 LDKUnsignedChannelAnnouncement this_ptr_conv;
20279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20280 this_ptr_conv.is_owned = false;
20281 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
20286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20287 LDKUnsignedChannelAnnouncement this_ptr_conv;
20288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20289 this_ptr_conv.is_owned = false;
20290 LDKThirtyTwoBytes val_ref;
20291 CHECK((*env)->GetArrayLength(env, val) == 32);
20292 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20293 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
20296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20297 LDKUnsignedChannelAnnouncement this_ptr_conv;
20298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20299 this_ptr_conv.is_owned = false;
20300 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
20304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20305 LDKUnsignedChannelAnnouncement this_ptr_conv;
20306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20307 this_ptr_conv.is_owned = false;
20308 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
20311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20312 LDKUnsignedChannelAnnouncement this_ptr_conv;
20313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20314 this_ptr_conv.is_owned = false;
20315 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20316 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
20320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20321 LDKUnsignedChannelAnnouncement this_ptr_conv;
20322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20323 this_ptr_conv.is_owned = false;
20324 LDKPublicKey val_ref;
20325 CHECK((*env)->GetArrayLength(env, val) == 33);
20326 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20327 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
20330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20331 LDKUnsignedChannelAnnouncement this_ptr_conv;
20332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20333 this_ptr_conv.is_owned = false;
20334 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20335 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
20339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20340 LDKUnsignedChannelAnnouncement this_ptr_conv;
20341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20342 this_ptr_conv.is_owned = false;
20343 LDKPublicKey val_ref;
20344 CHECK((*env)->GetArrayLength(env, val) == 33);
20345 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20346 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
20349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20350 LDKUnsignedChannelAnnouncement this_ptr_conv;
20351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20352 this_ptr_conv.is_owned = false;
20353 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20354 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
20358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20359 LDKUnsignedChannelAnnouncement this_ptr_conv;
20360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20361 this_ptr_conv.is_owned = false;
20362 LDKPublicKey val_ref;
20363 CHECK((*env)->GetArrayLength(env, val) == 33);
20364 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20365 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
20368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20369 LDKUnsignedChannelAnnouncement this_ptr_conv;
20370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20371 this_ptr_conv.is_owned = false;
20372 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20373 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
20377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20378 LDKUnsignedChannelAnnouncement this_ptr_conv;
20379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20380 this_ptr_conv.is_owned = false;
20381 LDKPublicKey val_ref;
20382 CHECK((*env)->GetArrayLength(env, val) == 33);
20383 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20384 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
20387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20388 LDKUnsignedChannelAnnouncement orig_conv;
20389 orig_conv.inner = (void*)(orig & (~1));
20390 orig_conv.is_owned = false;
20391 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
20392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20394 uint64_t ret_ref = (uint64_t)ret_var.inner;
20395 if (ret_var.is_owned) {
20401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20402 LDKChannelAnnouncement this_obj_conv;
20403 this_obj_conv.inner = (void*)(this_obj & (~1));
20404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20405 ChannelAnnouncement_free(this_obj_conv);
20408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20409 LDKChannelAnnouncement this_ptr_conv;
20410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20411 this_ptr_conv.is_owned = false;
20412 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20413 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
20417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20418 LDKChannelAnnouncement this_ptr_conv;
20419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20420 this_ptr_conv.is_owned = false;
20421 LDKSignature val_ref;
20422 CHECK((*env)->GetArrayLength(env, val) == 64);
20423 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20424 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
20427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20428 LDKChannelAnnouncement this_ptr_conv;
20429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20430 this_ptr_conv.is_owned = false;
20431 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20432 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
20436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20437 LDKChannelAnnouncement this_ptr_conv;
20438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20439 this_ptr_conv.is_owned = false;
20440 LDKSignature val_ref;
20441 CHECK((*env)->GetArrayLength(env, val) == 64);
20442 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20443 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
20446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20447 LDKChannelAnnouncement this_ptr_conv;
20448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20449 this_ptr_conv.is_owned = false;
20450 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20451 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
20455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20456 LDKChannelAnnouncement this_ptr_conv;
20457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20458 this_ptr_conv.is_owned = false;
20459 LDKSignature val_ref;
20460 CHECK((*env)->GetArrayLength(env, val) == 64);
20461 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20462 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
20465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20466 LDKChannelAnnouncement this_ptr_conv;
20467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20468 this_ptr_conv.is_owned = false;
20469 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
20474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20475 LDKChannelAnnouncement this_ptr_conv;
20476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20477 this_ptr_conv.is_owned = false;
20478 LDKSignature val_ref;
20479 CHECK((*env)->GetArrayLength(env, val) == 64);
20480 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20481 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
20484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20485 LDKChannelAnnouncement this_ptr_conv;
20486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20487 this_ptr_conv.is_owned = false;
20488 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
20489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20491 uint64_t ret_ref = (uint64_t)ret_var.inner;
20492 if (ret_var.is_owned) {
20498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20499 LDKChannelAnnouncement this_ptr_conv;
20500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20501 this_ptr_conv.is_owned = false;
20502 LDKUnsignedChannelAnnouncement val_conv;
20503 val_conv.inner = (void*)(val & (~1));
20504 val_conv.is_owned = (val & 1) || (val == 0);
20505 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
20506 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
20509 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) {
20510 LDKSignature node_signature_1_arg_ref;
20511 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
20512 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
20513 LDKSignature node_signature_2_arg_ref;
20514 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
20515 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
20516 LDKSignature bitcoin_signature_1_arg_ref;
20517 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
20518 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
20519 LDKSignature bitcoin_signature_2_arg_ref;
20520 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
20521 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
20522 LDKUnsignedChannelAnnouncement contents_arg_conv;
20523 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20524 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20525 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
20526 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);
20527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20529 uint64_t ret_ref = (uint64_t)ret_var.inner;
20530 if (ret_var.is_owned) {
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20537 LDKChannelAnnouncement orig_conv;
20538 orig_conv.inner = (void*)(orig & (~1));
20539 orig_conv.is_owned = false;
20540 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
20541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20543 uint64_t ret_ref = (uint64_t)ret_var.inner;
20544 if (ret_var.is_owned) {
20550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20551 LDKUnsignedChannelUpdate this_obj_conv;
20552 this_obj_conv.inner = (void*)(this_obj & (~1));
20553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20554 UnsignedChannelUpdate_free(this_obj_conv);
20557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20558 LDKUnsignedChannelUpdate this_ptr_conv;
20559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20560 this_ptr_conv.is_owned = false;
20561 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20562 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
20566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20567 LDKUnsignedChannelUpdate this_ptr_conv;
20568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20569 this_ptr_conv.is_owned = false;
20570 LDKThirtyTwoBytes val_ref;
20571 CHECK((*env)->GetArrayLength(env, val) == 32);
20572 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20573 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
20576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20577 LDKUnsignedChannelUpdate this_ptr_conv;
20578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20579 this_ptr_conv.is_owned = false;
20580 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
20584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20585 LDKUnsignedChannelUpdate this_ptr_conv;
20586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20587 this_ptr_conv.is_owned = false;
20588 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
20591 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
20592 LDKUnsignedChannelUpdate this_ptr_conv;
20593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20594 this_ptr_conv.is_owned = false;
20595 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
20599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20600 LDKUnsignedChannelUpdate this_ptr_conv;
20601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20602 this_ptr_conv.is_owned = false;
20603 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
20606 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
20607 LDKUnsignedChannelUpdate this_ptr_conv;
20608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20609 this_ptr_conv.is_owned = false;
20610 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
20614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
20615 LDKUnsignedChannelUpdate this_ptr_conv;
20616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20617 this_ptr_conv.is_owned = false;
20618 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
20621 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
20622 LDKUnsignedChannelUpdate this_ptr_conv;
20623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20624 this_ptr_conv.is_owned = false;
20625 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
20629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20630 LDKUnsignedChannelUpdate this_ptr_conv;
20631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20632 this_ptr_conv.is_owned = false;
20633 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
20636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20637 LDKUnsignedChannelUpdate this_ptr_conv;
20638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20639 this_ptr_conv.is_owned = false;
20640 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
20644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20645 LDKUnsignedChannelUpdate this_ptr_conv;
20646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20647 this_ptr_conv.is_owned = false;
20648 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
20651 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20652 LDKUnsignedChannelUpdate this_ptr_conv;
20653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20654 this_ptr_conv.is_owned = false;
20655 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
20659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20660 LDKUnsignedChannelUpdate this_ptr_conv;
20661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20662 this_ptr_conv.is_owned = false;
20663 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
20666 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
20667 LDKUnsignedChannelUpdate this_ptr_conv;
20668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20669 this_ptr_conv.is_owned = false;
20670 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
20674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20675 LDKUnsignedChannelUpdate this_ptr_conv;
20676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20677 this_ptr_conv.is_owned = false;
20678 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
20681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20682 LDKUnsignedChannelUpdate orig_conv;
20683 orig_conv.inner = (void*)(orig & (~1));
20684 orig_conv.is_owned = false;
20685 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
20686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20688 uint64_t ret_ref = (uint64_t)ret_var.inner;
20689 if (ret_var.is_owned) {
20695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20696 LDKChannelUpdate this_obj_conv;
20697 this_obj_conv.inner = (void*)(this_obj & (~1));
20698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20699 ChannelUpdate_free(this_obj_conv);
20702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20703 LDKChannelUpdate this_ptr_conv;
20704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20705 this_ptr_conv.is_owned = false;
20706 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20707 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
20711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20712 LDKChannelUpdate this_ptr_conv;
20713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20714 this_ptr_conv.is_owned = false;
20715 LDKSignature val_ref;
20716 CHECK((*env)->GetArrayLength(env, val) == 64);
20717 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20718 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
20721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20722 LDKChannelUpdate this_ptr_conv;
20723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20724 this_ptr_conv.is_owned = false;
20725 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
20726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20728 uint64_t ret_ref = (uint64_t)ret_var.inner;
20729 if (ret_var.is_owned) {
20735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20736 LDKChannelUpdate this_ptr_conv;
20737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20738 this_ptr_conv.is_owned = false;
20739 LDKUnsignedChannelUpdate val_conv;
20740 val_conv.inner = (void*)(val & (~1));
20741 val_conv.is_owned = (val & 1) || (val == 0);
20742 val_conv = UnsignedChannelUpdate_clone(&val_conv);
20743 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
20746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
20747 LDKSignature signature_arg_ref;
20748 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20749 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20750 LDKUnsignedChannelUpdate contents_arg_conv;
20751 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20752 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20753 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
20754 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
20755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20757 uint64_t ret_ref = (uint64_t)ret_var.inner;
20758 if (ret_var.is_owned) {
20764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20765 LDKChannelUpdate orig_conv;
20766 orig_conv.inner = (void*)(orig & (~1));
20767 orig_conv.is_owned = false;
20768 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
20769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20771 uint64_t ret_ref = (uint64_t)ret_var.inner;
20772 if (ret_var.is_owned) {
20778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20779 LDKQueryChannelRange this_obj_conv;
20780 this_obj_conv.inner = (void*)(this_obj & (~1));
20781 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20782 QueryChannelRange_free(this_obj_conv);
20785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20786 LDKQueryChannelRange this_ptr_conv;
20787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20788 this_ptr_conv.is_owned = false;
20789 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
20794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20795 LDKQueryChannelRange this_ptr_conv;
20796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20797 this_ptr_conv.is_owned = false;
20798 LDKThirtyTwoBytes val_ref;
20799 CHECK((*env)->GetArrayLength(env, val) == 32);
20800 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20801 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20804 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
20805 LDKQueryChannelRange this_ptr_conv;
20806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20807 this_ptr_conv.is_owned = false;
20808 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
20812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20813 LDKQueryChannelRange this_ptr_conv;
20814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20815 this_ptr_conv.is_owned = false;
20816 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
20819 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
20820 LDKQueryChannelRange this_ptr_conv;
20821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20822 this_ptr_conv.is_owned = false;
20823 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
20827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20828 LDKQueryChannelRange this_ptr_conv;
20829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20830 this_ptr_conv.is_owned = false;
20831 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20834 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) {
20835 LDKThirtyTwoBytes chain_hash_arg_ref;
20836 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20837 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20838 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
20839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20841 uint64_t ret_ref = (uint64_t)ret_var.inner;
20842 if (ret_var.is_owned) {
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20849 LDKQueryChannelRange orig_conv;
20850 orig_conv.inner = (void*)(orig & (~1));
20851 orig_conv.is_owned = false;
20852 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
20853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20855 uint64_t ret_ref = (uint64_t)ret_var.inner;
20856 if (ret_var.is_owned) {
20862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20863 LDKReplyChannelRange this_obj_conv;
20864 this_obj_conv.inner = (void*)(this_obj & (~1));
20865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20866 ReplyChannelRange_free(this_obj_conv);
20869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20870 LDKReplyChannelRange this_ptr_conv;
20871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20872 this_ptr_conv.is_owned = false;
20873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
20878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20879 LDKReplyChannelRange this_ptr_conv;
20880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20881 this_ptr_conv.is_owned = false;
20882 LDKThirtyTwoBytes val_ref;
20883 CHECK((*env)->GetArrayLength(env, val) == 32);
20884 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20885 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20888 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
20889 LDKReplyChannelRange this_ptr_conv;
20890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20891 this_ptr_conv.is_owned = false;
20892 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20897 LDKReplyChannelRange this_ptr_conv;
20898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20899 this_ptr_conv.is_owned = false;
20900 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20903 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
20904 LDKReplyChannelRange this_ptr_conv;
20905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20906 this_ptr_conv.is_owned = false;
20907 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20912 LDKReplyChannelRange this_ptr_conv;
20913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20914 this_ptr_conv.is_owned = false;
20915 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
20919 LDKReplyChannelRange this_ptr_conv;
20920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20921 this_ptr_conv.is_owned = false;
20922 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20927 LDKReplyChannelRange this_ptr_conv;
20928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20929 this_ptr_conv.is_owned = false;
20930 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20934 LDKReplyChannelRange this_ptr_conv;
20935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20936 this_ptr_conv.is_owned = false;
20937 LDKCVec_u64Z val_constr;
20938 val_constr.datalen = (*env)->GetArrayLength(env, val);
20939 if (val_constr.datalen > 0)
20940 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20942 val_constr.data = NULL;
20943 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20944 for (size_t g = 0; g < val_constr.datalen; g++) {
20945 int64_t val_conv_6 = val_vals[g];
20946 val_constr.data[g] = val_conv_6;
20948 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20949 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20952 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) {
20953 LDKThirtyTwoBytes chain_hash_arg_ref;
20954 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20955 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20956 LDKCVec_u64Z short_channel_ids_arg_constr;
20957 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
20958 if (short_channel_ids_arg_constr.datalen > 0)
20959 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20961 short_channel_ids_arg_constr.data = NULL;
20962 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
20963 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
20964 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
20965 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
20967 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
20968 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20971 uint64_t ret_ref = (uint64_t)ret_var.inner;
20972 if (ret_var.is_owned) {
20978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20979 LDKReplyChannelRange orig_conv;
20980 orig_conv.inner = (void*)(orig & (~1));
20981 orig_conv.is_owned = false;
20982 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20985 uint64_t ret_ref = (uint64_t)ret_var.inner;
20986 if (ret_var.is_owned) {
20992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20993 LDKQueryShortChannelIds this_obj_conv;
20994 this_obj_conv.inner = (void*)(this_obj & (~1));
20995 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20996 QueryShortChannelIds_free(this_obj_conv);
20999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21000 LDKQueryShortChannelIds this_ptr_conv;
21001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21002 this_ptr_conv.is_owned = false;
21003 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21004 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
21008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21009 LDKQueryShortChannelIds this_ptr_conv;
21010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21011 this_ptr_conv.is_owned = false;
21012 LDKThirtyTwoBytes val_ref;
21013 CHECK((*env)->GetArrayLength(env, val) == 32);
21014 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21015 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
21018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21019 LDKQueryShortChannelIds this_ptr_conv;
21020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21021 this_ptr_conv.is_owned = false;
21022 LDKCVec_u64Z val_constr;
21023 val_constr.datalen = (*env)->GetArrayLength(env, val);
21024 if (val_constr.datalen > 0)
21025 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21027 val_constr.data = NULL;
21028 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21029 for (size_t g = 0; g < val_constr.datalen; g++) {
21030 int64_t val_conv_6 = val_vals[g];
21031 val_constr.data[g] = val_conv_6;
21033 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21034 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
21037 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) {
21038 LDKThirtyTwoBytes chain_hash_arg_ref;
21039 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21040 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21041 LDKCVec_u64Z short_channel_ids_arg_constr;
21042 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
21043 if (short_channel_ids_arg_constr.datalen > 0)
21044 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21046 short_channel_ids_arg_constr.data = NULL;
21047 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
21048 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
21049 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
21050 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
21052 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
21053 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
21054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21056 uint64_t ret_ref = (uint64_t)ret_var.inner;
21057 if (ret_var.is_owned) {
21063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21064 LDKQueryShortChannelIds orig_conv;
21065 orig_conv.inner = (void*)(orig & (~1));
21066 orig_conv.is_owned = false;
21067 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
21068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21070 uint64_t ret_ref = (uint64_t)ret_var.inner;
21071 if (ret_var.is_owned) {
21077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21078 LDKReplyShortChannelIdsEnd this_obj_conv;
21079 this_obj_conv.inner = (void*)(this_obj & (~1));
21080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21081 ReplyShortChannelIdsEnd_free(this_obj_conv);
21084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21085 LDKReplyShortChannelIdsEnd this_ptr_conv;
21086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21087 this_ptr_conv.is_owned = false;
21088 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21089 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
21093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21094 LDKReplyShortChannelIdsEnd this_ptr_conv;
21095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21096 this_ptr_conv.is_owned = false;
21097 LDKThirtyTwoBytes val_ref;
21098 CHECK((*env)->GetArrayLength(env, val) == 32);
21099 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21100 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
21103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
21104 LDKReplyShortChannelIdsEnd this_ptr_conv;
21105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21106 this_ptr_conv.is_owned = false;
21107 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
21111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21112 LDKReplyShortChannelIdsEnd this_ptr_conv;
21113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21114 this_ptr_conv.is_owned = false;
21115 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
21118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
21119 LDKThirtyTwoBytes chain_hash_arg_ref;
21120 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21121 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21122 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
21123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21125 uint64_t ret_ref = (uint64_t)ret_var.inner;
21126 if (ret_var.is_owned) {
21132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21133 LDKReplyShortChannelIdsEnd orig_conv;
21134 orig_conv.inner = (void*)(orig & (~1));
21135 orig_conv.is_owned = false;
21136 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
21137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21139 uint64_t ret_ref = (uint64_t)ret_var.inner;
21140 if (ret_var.is_owned) {
21146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21147 LDKGossipTimestampFilter this_obj_conv;
21148 this_obj_conv.inner = (void*)(this_obj & (~1));
21149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21150 GossipTimestampFilter_free(this_obj_conv);
21153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21154 LDKGossipTimestampFilter this_ptr_conv;
21155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21156 this_ptr_conv.is_owned = false;
21157 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
21162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21163 LDKGossipTimestampFilter this_ptr_conv;
21164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21165 this_ptr_conv.is_owned = false;
21166 LDKThirtyTwoBytes val_ref;
21167 CHECK((*env)->GetArrayLength(env, val) == 32);
21168 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21169 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
21172 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
21173 LDKGossipTimestampFilter this_ptr_conv;
21174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21175 this_ptr_conv.is_owned = false;
21176 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
21180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21181 LDKGossipTimestampFilter this_ptr_conv;
21182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21183 this_ptr_conv.is_owned = false;
21184 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
21187 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
21188 LDKGossipTimestampFilter this_ptr_conv;
21189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21190 this_ptr_conv.is_owned = false;
21191 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
21195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21196 LDKGossipTimestampFilter this_ptr_conv;
21197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21198 this_ptr_conv.is_owned = false;
21199 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
21202 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) {
21203 LDKThirtyTwoBytes chain_hash_arg_ref;
21204 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21205 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21206 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
21207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21209 uint64_t ret_ref = (uint64_t)ret_var.inner;
21210 if (ret_var.is_owned) {
21216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21217 LDKGossipTimestampFilter orig_conv;
21218 orig_conv.inner = (void*)(orig & (~1));
21219 orig_conv.is_owned = false;
21220 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
21221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21223 uint64_t ret_ref = (uint64_t)ret_var.inner;
21224 if (ret_var.is_owned) {
21230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21231 if ((this_ptr & 1) != 0) return;
21232 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
21233 FREE((void*)this_ptr);
21234 ErrorAction_free(this_ptr_conv);
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21238 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
21239 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21240 *ret_copy = ErrorAction_clone(orig_conv);
21241 uint64_t ret_ref = (uint64_t)ret_copy;
21245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
21246 LDKErrorMessage msg_conv;
21247 msg_conv.inner = (void*)(msg & (~1));
21248 msg_conv.is_owned = (msg & 1) || (msg == 0);
21249 msg_conv = ErrorMessage_clone(&msg_conv);
21250 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21251 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
21252 uint64_t ret_ref = (uint64_t)ret_copy;
21256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
21257 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21258 *ret_copy = ErrorAction_ignore_error();
21259 uint64_t ret_ref = (uint64_t)ret_copy;
21263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
21264 LDKLevel a_conv = LDKLevel_from_java(env, a);
21265 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21266 *ret_copy = ErrorAction_ignore_and_log(a_conv);
21267 uint64_t ret_ref = (uint64_t)ret_copy;
21271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
21272 LDKErrorMessage msg_conv;
21273 msg_conv.inner = (void*)(msg & (~1));
21274 msg_conv.is_owned = (msg & 1) || (msg == 0);
21275 msg_conv = ErrorMessage_clone(&msg_conv);
21276 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21277 *ret_copy = ErrorAction_send_error_message(msg_conv);
21278 uint64_t ret_ref = (uint64_t)ret_copy;
21282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21283 LDKLightningError this_obj_conv;
21284 this_obj_conv.inner = (void*)(this_obj & (~1));
21285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21286 LightningError_free(this_obj_conv);
21289 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
21290 LDKLightningError this_ptr_conv;
21291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21292 this_ptr_conv.is_owned = false;
21293 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
21294 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
21300 LDKLightningError this_ptr_conv;
21301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21302 this_ptr_conv.is_owned = false;
21303 LDKStr val_conv = java_to_owned_str(env, val);
21304 LightningError_set_err(&this_ptr_conv, val_conv);
21307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
21308 LDKLightningError this_ptr_conv;
21309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21310 this_ptr_conv.is_owned = false;
21311 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21312 *ret_copy = LightningError_get_action(&this_ptr_conv);
21313 uint64_t ret_ref = (uint64_t)ret_copy;
21317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21318 LDKLightningError this_ptr_conv;
21319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21320 this_ptr_conv.is_owned = false;
21321 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
21322 LightningError_set_action(&this_ptr_conv, val_conv);
21325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
21326 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
21327 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
21328 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
21329 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21330 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21331 uint64_t ret_ref = (uint64_t)ret_var.inner;
21332 if (ret_var.is_owned) {
21338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21339 LDKLightningError orig_conv;
21340 orig_conv.inner = (void*)(orig & (~1));
21341 orig_conv.is_owned = false;
21342 LDKLightningError ret_var = LightningError_clone(&orig_conv);
21343 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21344 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21345 uint64_t ret_ref = (uint64_t)ret_var.inner;
21346 if (ret_var.is_owned) {
21352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21353 LDKCommitmentUpdate this_obj_conv;
21354 this_obj_conv.inner = (void*)(this_obj & (~1));
21355 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21356 CommitmentUpdate_free(this_obj_conv);
21359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21360 LDKCommitmentUpdate this_ptr_conv;
21361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21362 this_ptr_conv.is_owned = false;
21363 LDKCVec_UpdateAddHTLCZ val_constr;
21364 val_constr.datalen = (*env)->GetArrayLength(env, val);
21365 if (val_constr.datalen > 0)
21366 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21368 val_constr.data = NULL;
21369 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21370 for (size_t p = 0; p < val_constr.datalen; p++) {
21371 int64_t val_conv_15 = val_vals[p];
21372 LDKUpdateAddHTLC val_conv_15_conv;
21373 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
21374 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
21375 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
21376 val_constr.data[p] = val_conv_15_conv;
21378 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21379 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
21382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21383 LDKCommitmentUpdate this_ptr_conv;
21384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21385 this_ptr_conv.is_owned = false;
21386 LDKCVec_UpdateFulfillHTLCZ val_constr;
21387 val_constr.datalen = (*env)->GetArrayLength(env, val);
21388 if (val_constr.datalen > 0)
21389 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21391 val_constr.data = NULL;
21392 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21393 for (size_t t = 0; t < val_constr.datalen; t++) {
21394 int64_t val_conv_19 = val_vals[t];
21395 LDKUpdateFulfillHTLC val_conv_19_conv;
21396 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
21397 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
21398 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
21399 val_constr.data[t] = val_conv_19_conv;
21401 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21402 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
21405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21406 LDKCommitmentUpdate this_ptr_conv;
21407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21408 this_ptr_conv.is_owned = false;
21409 LDKCVec_UpdateFailHTLCZ val_constr;
21410 val_constr.datalen = (*env)->GetArrayLength(env, val);
21411 if (val_constr.datalen > 0)
21412 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21414 val_constr.data = NULL;
21415 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21416 for (size_t q = 0; q < val_constr.datalen; q++) {
21417 int64_t val_conv_16 = val_vals[q];
21418 LDKUpdateFailHTLC val_conv_16_conv;
21419 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
21420 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
21421 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
21422 val_constr.data[q] = val_conv_16_conv;
21424 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21425 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
21428 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) {
21429 LDKCommitmentUpdate this_ptr_conv;
21430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21431 this_ptr_conv.is_owned = false;
21432 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
21433 val_constr.datalen = (*env)->GetArrayLength(env, val);
21434 if (val_constr.datalen > 0)
21435 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21437 val_constr.data = NULL;
21438 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21439 for (size_t z = 0; z < val_constr.datalen; z++) {
21440 int64_t val_conv_25 = val_vals[z];
21441 LDKUpdateFailMalformedHTLC val_conv_25_conv;
21442 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
21443 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
21444 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
21445 val_constr.data[z] = val_conv_25_conv;
21447 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21448 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
21451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
21452 LDKCommitmentUpdate this_ptr_conv;
21453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21454 this_ptr_conv.is_owned = false;
21455 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
21456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21458 uint64_t ret_ref = (uint64_t)ret_var.inner;
21459 if (ret_var.is_owned) {
21465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21466 LDKCommitmentUpdate this_ptr_conv;
21467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21468 this_ptr_conv.is_owned = false;
21469 LDKUpdateFee val_conv;
21470 val_conv.inner = (void*)(val & (~1));
21471 val_conv.is_owned = (val & 1) || (val == 0);
21472 val_conv = UpdateFee_clone(&val_conv);
21473 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
21476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
21477 LDKCommitmentUpdate this_ptr_conv;
21478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21479 this_ptr_conv.is_owned = false;
21480 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
21481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21483 uint64_t ret_ref = (uint64_t)ret_var.inner;
21484 if (ret_var.is_owned) {
21490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21491 LDKCommitmentUpdate this_ptr_conv;
21492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21493 this_ptr_conv.is_owned = false;
21494 LDKCommitmentSigned val_conv;
21495 val_conv.inner = (void*)(val & (~1));
21496 val_conv.is_owned = (val & 1) || (val == 0);
21497 val_conv = CommitmentSigned_clone(&val_conv);
21498 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
21501 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) {
21502 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
21503 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
21504 if (update_add_htlcs_arg_constr.datalen > 0)
21505 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21507 update_add_htlcs_arg_constr.data = NULL;
21508 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
21509 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
21510 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
21511 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
21512 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
21513 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
21514 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
21515 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
21517 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
21518 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
21519 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
21520 if (update_fulfill_htlcs_arg_constr.datalen > 0)
21521 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21523 update_fulfill_htlcs_arg_constr.data = NULL;
21524 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
21525 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
21526 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
21527 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
21528 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
21529 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
21530 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
21531 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
21533 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
21534 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
21535 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
21536 if (update_fail_htlcs_arg_constr.datalen > 0)
21537 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21539 update_fail_htlcs_arg_constr.data = NULL;
21540 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
21541 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
21542 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
21543 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
21544 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
21545 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
21546 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
21547 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
21549 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
21550 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
21551 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
21552 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
21553 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21555 update_fail_malformed_htlcs_arg_constr.data = NULL;
21556 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
21557 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
21558 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
21559 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
21560 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
21561 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);
21562 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
21563 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
21565 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
21566 LDKUpdateFee update_fee_arg_conv;
21567 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
21568 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
21569 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
21570 LDKCommitmentSigned commitment_signed_arg_conv;
21571 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
21572 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
21573 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
21574 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);
21575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21577 uint64_t ret_ref = (uint64_t)ret_var.inner;
21578 if (ret_var.is_owned) {
21584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21585 LDKCommitmentUpdate orig_conv;
21586 orig_conv.inner = (void*)(orig & (~1));
21587 orig_conv.is_owned = false;
21588 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
21589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21591 uint64_t ret_ref = (uint64_t)ret_var.inner;
21592 if (ret_var.is_owned) {
21598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21599 if ((this_ptr & 1) != 0) return;
21600 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
21601 FREE((void*)this_ptr);
21602 HTLCFailChannelUpdate_free(this_ptr_conv);
21605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21606 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
21607 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21608 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
21609 uint64_t ret_ref = (uint64_t)ret_copy;
21613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
21614 LDKChannelUpdate msg_conv;
21615 msg_conv.inner = (void*)(msg & (~1));
21616 msg_conv.is_owned = (msg & 1) || (msg == 0);
21617 msg_conv = ChannelUpdate_clone(&msg_conv);
21618 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21619 *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
21620 uint64_t ret_ref = (uint64_t)ret_copy;
21624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
21625 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21626 *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
21627 uint64_t ret_ref = (uint64_t)ret_copy;
21631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
21632 LDKPublicKey node_id_ref;
21633 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21634 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21635 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21636 *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
21637 uint64_t ret_ref = (uint64_t)ret_copy;
21641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21642 if ((this_ptr & 1) != 0) return;
21643 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
21644 FREE((void*)this_ptr);
21645 ChannelMessageHandler_free(this_ptr_conv);
21648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21649 if ((this_ptr & 1) != 0) return;
21650 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
21651 FREE((void*)this_ptr);
21652 RoutingMessageHandler_free(this_ptr_conv);
21655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
21656 LDKAcceptChannel obj_conv;
21657 obj_conv.inner = (void*)(obj & (~1));
21658 obj_conv.is_owned = false;
21659 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
21660 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21661 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21662 CVec_u8Z_free(ret_var);
21666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21667 LDKu8slice ser_ref;
21668 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21669 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21670 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21671 *ret_conv = AcceptChannel_read(ser_ref);
21672 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21673 return (uint64_t)ret_conv;
21676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
21677 LDKAnnouncementSignatures obj_conv;
21678 obj_conv.inner = (void*)(obj & (~1));
21679 obj_conv.is_owned = false;
21680 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
21681 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21682 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21683 CVec_u8Z_free(ret_var);
21687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21688 LDKu8slice ser_ref;
21689 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21690 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21691 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21692 *ret_conv = AnnouncementSignatures_read(ser_ref);
21693 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21694 return (uint64_t)ret_conv;
21697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
21698 LDKChannelReestablish obj_conv;
21699 obj_conv.inner = (void*)(obj & (~1));
21700 obj_conv.is_owned = false;
21701 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
21702 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21703 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21704 CVec_u8Z_free(ret_var);
21708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21709 LDKu8slice ser_ref;
21710 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21711 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21712 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21713 *ret_conv = ChannelReestablish_read(ser_ref);
21714 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21715 return (uint64_t)ret_conv;
21718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21719 LDKClosingSigned obj_conv;
21720 obj_conv.inner = (void*)(obj & (~1));
21721 obj_conv.is_owned = false;
21722 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
21723 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21724 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21725 CVec_u8Z_free(ret_var);
21729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21730 LDKu8slice ser_ref;
21731 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21732 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21733 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21734 *ret_conv = ClosingSigned_read(ser_ref);
21735 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21736 return (uint64_t)ret_conv;
21739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
21740 LDKClosingSignedFeeRange obj_conv;
21741 obj_conv.inner = (void*)(obj & (~1));
21742 obj_conv.is_owned = false;
21743 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
21744 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21745 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21746 CVec_u8Z_free(ret_var);
21750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21751 LDKu8slice ser_ref;
21752 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21753 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21754 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21755 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
21756 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21757 return (uint64_t)ret_conv;
21760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21761 LDKCommitmentSigned obj_conv;
21762 obj_conv.inner = (void*)(obj & (~1));
21763 obj_conv.is_owned = false;
21764 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
21765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21767 CVec_u8Z_free(ret_var);
21771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21772 LDKu8slice ser_ref;
21773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21775 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21776 *ret_conv = CommitmentSigned_read(ser_ref);
21777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21778 return (uint64_t)ret_conv;
21781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
21782 LDKFundingCreated obj_conv;
21783 obj_conv.inner = (void*)(obj & (~1));
21784 obj_conv.is_owned = false;
21785 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
21786 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21787 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21788 CVec_u8Z_free(ret_var);
21792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21793 LDKu8slice ser_ref;
21794 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21795 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21796 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21797 *ret_conv = FundingCreated_read(ser_ref);
21798 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21799 return (uint64_t)ret_conv;
21802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21803 LDKFundingSigned obj_conv;
21804 obj_conv.inner = (void*)(obj & (~1));
21805 obj_conv.is_owned = false;
21806 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
21807 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21808 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21809 CVec_u8Z_free(ret_var);
21813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21814 LDKu8slice ser_ref;
21815 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21816 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21817 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21818 *ret_conv = FundingSigned_read(ser_ref);
21819 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21820 return (uint64_t)ret_conv;
21823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
21824 LDKFundingLocked obj_conv;
21825 obj_conv.inner = (void*)(obj & (~1));
21826 obj_conv.is_owned = false;
21827 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
21828 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21829 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21830 CVec_u8Z_free(ret_var);
21834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21835 LDKu8slice ser_ref;
21836 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21837 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21838 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21839 *ret_conv = FundingLocked_read(ser_ref);
21840 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21841 return (uint64_t)ret_conv;
21844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
21846 obj_conv.inner = (void*)(obj & (~1));
21847 obj_conv.is_owned = false;
21848 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
21849 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21850 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21851 CVec_u8Z_free(ret_var);
21855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21856 LDKu8slice ser_ref;
21857 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21858 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21859 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21860 *ret_conv = Init_read(ser_ref);
21861 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21862 return (uint64_t)ret_conv;
21865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
21866 LDKOpenChannel obj_conv;
21867 obj_conv.inner = (void*)(obj & (~1));
21868 obj_conv.is_owned = false;
21869 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
21870 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21871 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21872 CVec_u8Z_free(ret_var);
21876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21877 LDKu8slice ser_ref;
21878 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21879 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21880 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21881 *ret_conv = OpenChannel_read(ser_ref);
21882 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21883 return (uint64_t)ret_conv;
21886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
21887 LDKRevokeAndACK obj_conv;
21888 obj_conv.inner = (void*)(obj & (~1));
21889 obj_conv.is_owned = false;
21890 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
21891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21893 CVec_u8Z_free(ret_var);
21897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21898 LDKu8slice ser_ref;
21899 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21900 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21901 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21902 *ret_conv = RevokeAndACK_read(ser_ref);
21903 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21904 return (uint64_t)ret_conv;
21907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
21908 LDKShutdown obj_conv;
21909 obj_conv.inner = (void*)(obj & (~1));
21910 obj_conv.is_owned = false;
21911 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
21912 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21913 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21914 CVec_u8Z_free(ret_var);
21918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21919 LDKu8slice ser_ref;
21920 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21921 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21922 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21923 *ret_conv = Shutdown_read(ser_ref);
21924 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21925 return (uint64_t)ret_conv;
21928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21929 LDKUpdateFailHTLC obj_conv;
21930 obj_conv.inner = (void*)(obj & (~1));
21931 obj_conv.is_owned = false;
21932 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
21933 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21934 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21935 CVec_u8Z_free(ret_var);
21939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21940 LDKu8slice ser_ref;
21941 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21942 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21943 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21944 *ret_conv = UpdateFailHTLC_read(ser_ref);
21945 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21946 return (uint64_t)ret_conv;
21949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21950 LDKUpdateFailMalformedHTLC obj_conv;
21951 obj_conv.inner = (void*)(obj & (~1));
21952 obj_conv.is_owned = false;
21953 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
21954 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21955 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21956 CVec_u8Z_free(ret_var);
21960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21961 LDKu8slice ser_ref;
21962 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21963 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21964 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21965 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21966 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21967 return (uint64_t)ret_conv;
21970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
21971 LDKUpdateFee obj_conv;
21972 obj_conv.inner = (void*)(obj & (~1));
21973 obj_conv.is_owned = false;
21974 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21975 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21976 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21977 CVec_u8Z_free(ret_var);
21981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21982 LDKu8slice ser_ref;
21983 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21984 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21985 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21986 *ret_conv = UpdateFee_read(ser_ref);
21987 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21988 return (uint64_t)ret_conv;
21991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21992 LDKUpdateFulfillHTLC obj_conv;
21993 obj_conv.inner = (void*)(obj & (~1));
21994 obj_conv.is_owned = false;
21995 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21996 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21997 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21998 CVec_u8Z_free(ret_var);
22002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22003 LDKu8slice ser_ref;
22004 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22005 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22006 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22007 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
22008 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22009 return (uint64_t)ret_conv;
22012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
22013 LDKUpdateAddHTLC obj_conv;
22014 obj_conv.inner = (void*)(obj & (~1));
22015 obj_conv.is_owned = false;
22016 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
22017 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22018 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22019 CVec_u8Z_free(ret_var);
22023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22024 LDKu8slice ser_ref;
22025 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22026 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22027 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22028 *ret_conv = UpdateAddHTLC_read(ser_ref);
22029 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22030 return (uint64_t)ret_conv;
22033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
22035 obj_conv.inner = (void*)(obj & (~1));
22036 obj_conv.is_owned = false;
22037 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
22038 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22039 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22040 CVec_u8Z_free(ret_var);
22044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22045 LDKu8slice ser_ref;
22046 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22047 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22048 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22049 *ret_conv = Ping_read(ser_ref);
22050 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22051 return (uint64_t)ret_conv;
22054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
22056 obj_conv.inner = (void*)(obj & (~1));
22057 obj_conv.is_owned = false;
22058 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
22059 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22060 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22061 CVec_u8Z_free(ret_var);
22065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22066 LDKu8slice ser_ref;
22067 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22068 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22069 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22070 *ret_conv = Pong_read(ser_ref);
22071 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22072 return (uint64_t)ret_conv;
22075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22076 LDKUnsignedChannelAnnouncement obj_conv;
22077 obj_conv.inner = (void*)(obj & (~1));
22078 obj_conv.is_owned = false;
22079 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
22080 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22081 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22082 CVec_u8Z_free(ret_var);
22086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22087 LDKu8slice ser_ref;
22088 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22089 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22090 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22091 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
22092 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22093 return (uint64_t)ret_conv;
22096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22097 LDKChannelAnnouncement obj_conv;
22098 obj_conv.inner = (void*)(obj & (~1));
22099 obj_conv.is_owned = false;
22100 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
22101 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22102 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22103 CVec_u8Z_free(ret_var);
22107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22108 LDKu8slice ser_ref;
22109 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22110 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22111 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22112 *ret_conv = ChannelAnnouncement_read(ser_ref);
22113 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22114 return (uint64_t)ret_conv;
22117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22118 LDKUnsignedChannelUpdate obj_conv;
22119 obj_conv.inner = (void*)(obj & (~1));
22120 obj_conv.is_owned = false;
22121 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
22122 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22123 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22124 CVec_u8Z_free(ret_var);
22128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22129 LDKu8slice ser_ref;
22130 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22131 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22132 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22133 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
22134 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22135 return (uint64_t)ret_conv;
22138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22139 LDKChannelUpdate obj_conv;
22140 obj_conv.inner = (void*)(obj & (~1));
22141 obj_conv.is_owned = false;
22142 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
22143 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22144 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22145 CVec_u8Z_free(ret_var);
22149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22150 LDKu8slice ser_ref;
22151 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22152 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22153 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22154 *ret_conv = ChannelUpdate_read(ser_ref);
22155 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22156 return (uint64_t)ret_conv;
22159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
22160 LDKErrorMessage obj_conv;
22161 obj_conv.inner = (void*)(obj & (~1));
22162 obj_conv.is_owned = false;
22163 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
22164 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22165 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22166 CVec_u8Z_free(ret_var);
22170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22171 LDKu8slice ser_ref;
22172 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22173 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22174 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22175 *ret_conv = ErrorMessage_read(ser_ref);
22176 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22177 return (uint64_t)ret_conv;
22180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22181 LDKUnsignedNodeAnnouncement obj_conv;
22182 obj_conv.inner = (void*)(obj & (~1));
22183 obj_conv.is_owned = false;
22184 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
22185 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22186 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22187 CVec_u8Z_free(ret_var);
22191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22192 LDKu8slice ser_ref;
22193 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22194 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22195 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22196 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
22197 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22198 return (uint64_t)ret_conv;
22201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22202 LDKNodeAnnouncement obj_conv;
22203 obj_conv.inner = (void*)(obj & (~1));
22204 obj_conv.is_owned = false;
22205 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
22206 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22207 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22208 CVec_u8Z_free(ret_var);
22212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22213 LDKu8slice ser_ref;
22214 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22215 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22216 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22217 *ret_conv = NodeAnnouncement_read(ser_ref);
22218 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22219 return (uint64_t)ret_conv;
22222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22223 LDKu8slice ser_ref;
22224 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22225 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22226 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22227 *ret_conv = QueryShortChannelIds_read(ser_ref);
22228 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22229 return (uint64_t)ret_conv;
22232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
22233 LDKQueryShortChannelIds obj_conv;
22234 obj_conv.inner = (void*)(obj & (~1));
22235 obj_conv.is_owned = false;
22236 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
22237 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22238 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22239 CVec_u8Z_free(ret_var);
22243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22244 LDKu8slice ser_ref;
22245 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22246 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22247 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22248 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
22249 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22250 return (uint64_t)ret_conv;
22253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
22254 LDKReplyShortChannelIdsEnd obj_conv;
22255 obj_conv.inner = (void*)(obj & (~1));
22256 obj_conv.is_owned = false;
22257 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
22258 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22259 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22260 CVec_u8Z_free(ret_var);
22264 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
22265 LDKQueryChannelRange this_arg_conv;
22266 this_arg_conv.inner = (void*)(this_arg & (~1));
22267 this_arg_conv.is_owned = false;
22268 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
22272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22273 LDKu8slice ser_ref;
22274 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22275 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22276 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22277 *ret_conv = QueryChannelRange_read(ser_ref);
22278 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22279 return (uint64_t)ret_conv;
22282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
22283 LDKQueryChannelRange obj_conv;
22284 obj_conv.inner = (void*)(obj & (~1));
22285 obj_conv.is_owned = false;
22286 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
22287 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22288 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22289 CVec_u8Z_free(ret_var);
22293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22294 LDKu8slice ser_ref;
22295 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22296 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22297 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22298 *ret_conv = ReplyChannelRange_read(ser_ref);
22299 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22300 return (uint64_t)ret_conv;
22303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
22304 LDKReplyChannelRange obj_conv;
22305 obj_conv.inner = (void*)(obj & (~1));
22306 obj_conv.is_owned = false;
22307 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
22308 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22309 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22310 CVec_u8Z_free(ret_var);
22314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22315 LDKu8slice ser_ref;
22316 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22317 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22318 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22319 *ret_conv = GossipTimestampFilter_read(ser_ref);
22320 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22321 return (uint64_t)ret_conv;
22324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
22325 LDKGossipTimestampFilter obj_conv;
22326 obj_conv.inner = (void*)(obj & (~1));
22327 obj_conv.is_owned = false;
22328 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
22329 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22330 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22331 CVec_u8Z_free(ret_var);
22335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22336 LDKIgnoringMessageHandler this_obj_conv;
22337 this_obj_conv.inner = (void*)(this_obj & (~1));
22338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22339 IgnoringMessageHandler_free(this_obj_conv);
22342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
22343 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
22344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22346 uint64_t ret_ref = (uint64_t)ret_var.inner;
22347 if (ret_var.is_owned) {
22353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
22354 LDKIgnoringMessageHandler this_arg_conv;
22355 this_arg_conv.inner = (void*)(this_arg & (~1));
22356 this_arg_conv.is_owned = false;
22357 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22358 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22359 return (uint64_t)ret;
22362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
22363 LDKIgnoringMessageHandler this_arg_conv;
22364 this_arg_conv.inner = (void*)(this_arg & (~1));
22365 this_arg_conv.is_owned = false;
22366 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
22367 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
22368 return (uint64_t)ret;
22371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22372 LDKErroringMessageHandler this_obj_conv;
22373 this_obj_conv.inner = (void*)(this_obj & (~1));
22374 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22375 ErroringMessageHandler_free(this_obj_conv);
22378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
22379 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
22380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22382 uint64_t ret_ref = (uint64_t)ret_var.inner;
22383 if (ret_var.is_owned) {
22389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
22390 LDKErroringMessageHandler this_arg_conv;
22391 this_arg_conv.inner = (void*)(this_arg & (~1));
22392 this_arg_conv.is_owned = false;
22393 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22394 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22395 return (uint64_t)ret;
22398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
22399 LDKErroringMessageHandler this_arg_conv;
22400 this_arg_conv.inner = (void*)(this_arg & (~1));
22401 this_arg_conv.is_owned = false;
22402 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22403 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
22404 return (uint64_t)ret;
22407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22408 LDKMessageHandler this_obj_conv;
22409 this_obj_conv.inner = (void*)(this_obj & (~1));
22410 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22411 MessageHandler_free(this_obj_conv);
22414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
22415 LDKMessageHandler this_ptr_conv;
22416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22417 this_ptr_conv.is_owned = false;
22418 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
22422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22423 LDKMessageHandler this_ptr_conv;
22424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22425 this_ptr_conv.is_owned = false;
22426 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
22427 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
22428 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22429 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
22431 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
22434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
22435 LDKMessageHandler this_ptr_conv;
22436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22437 this_ptr_conv.is_owned = false;
22438 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
22442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22443 LDKMessageHandler this_ptr_conv;
22444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22445 this_ptr_conv.is_owned = false;
22446 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
22447 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
22448 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22449 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
22451 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
22454 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) {
22455 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
22456 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
22457 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22458 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
22460 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
22461 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
22462 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22463 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
22465 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
22466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22468 uint64_t ret_ref = (uint64_t)ret_var.inner;
22469 if (ret_var.is_owned) {
22475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22476 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
22477 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22478 *ret = SocketDescriptor_clone(orig_conv);
22479 return (uint64_t)ret;
22482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22483 if ((this_ptr & 1) != 0) return;
22484 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
22485 FREE((void*)this_ptr);
22486 SocketDescriptor_free(this_ptr_conv);
22489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22490 LDKPeerHandleError this_obj_conv;
22491 this_obj_conv.inner = (void*)(this_obj & (~1));
22492 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22493 PeerHandleError_free(this_obj_conv);
22496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
22497 LDKPeerHandleError this_ptr_conv;
22498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22499 this_ptr_conv.is_owned = false;
22500 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
22504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22505 LDKPeerHandleError this_ptr_conv;
22506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22507 this_ptr_conv.is_owned = false;
22508 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
22511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
22512 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
22513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22515 uint64_t ret_ref = (uint64_t)ret_var.inner;
22516 if (ret_var.is_owned) {
22522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22523 LDKPeerHandleError orig_conv;
22524 orig_conv.inner = (void*)(orig & (~1));
22525 orig_conv.is_owned = false;
22526 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
22527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22529 uint64_t ret_ref = (uint64_t)ret_var.inner;
22530 if (ret_var.is_owned) {
22536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22537 LDKPeerManager this_obj_conv;
22538 this_obj_conv.inner = (void*)(this_obj & (~1));
22539 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22540 PeerManager_free(this_obj_conv);
22543 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) {
22544 LDKMessageHandler message_handler_conv;
22545 message_handler_conv.inner = (void*)(message_handler & (~1));
22546 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
22547 // Warning: we need a move here but no clone is available for LDKMessageHandler
22548 LDKSecretKey our_node_secret_ref;
22549 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
22550 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
22551 unsigned char ephemeral_random_data_arr[32];
22552 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
22553 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
22554 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
22555 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22556 if (logger_conv.free == LDKLogger_JCalls_free) {
22557 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22558 LDKLogger_JCalls_cloned(&logger_conv);
22560 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
22561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22563 uint64_t ret_ref = (uint64_t)ret_var.inner;
22564 if (ret_var.is_owned) {
22570 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
22571 LDKPeerManager this_arg_conv;
22572 this_arg_conv.inner = (void*)(this_arg & (~1));
22573 this_arg_conv.is_owned = false;
22574 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
22575 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
22577 for (size_t i = 0; i < ret_var.datalen; i++) {
22578 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
22579 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
22580 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
22582 FREE(ret_var.data);
22586 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) {
22587 LDKPeerManager this_arg_conv;
22588 this_arg_conv.inner = (void*)(this_arg & (~1));
22589 this_arg_conv.is_owned = false;
22590 LDKPublicKey their_node_id_ref;
22591 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22592 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22593 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22594 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
22595 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22596 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
22598 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22599 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
22600 return (uint64_t)ret_conv;
22603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
22604 LDKPeerManager this_arg_conv;
22605 this_arg_conv.inner = (void*)(this_arg & (~1));
22606 this_arg_conv.is_owned = false;
22607 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22608 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
22609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22610 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
22612 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22613 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
22614 return (uint64_t)ret_conv;
22617 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) {
22618 LDKPeerManager this_arg_conv;
22619 this_arg_conv.inner = (void*)(this_arg & (~1));
22620 this_arg_conv.is_owned = false;
22621 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22622 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22623 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
22624 return (uint64_t)ret_conv;
22627 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) {
22628 LDKPeerManager this_arg_conv;
22629 this_arg_conv.inner = (void*)(this_arg & (~1));
22630 this_arg_conv.is_owned = false;
22631 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
22632 LDKu8slice data_ref;
22633 data_ref.datalen = (*env)->GetArrayLength(env, data);
22634 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
22635 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22636 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
22637 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
22638 return (uint64_t)ret_conv;
22641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
22642 LDKPeerManager this_arg_conv;
22643 this_arg_conv.inner = (void*)(this_arg & (~1));
22644 this_arg_conv.is_owned = false;
22645 PeerManager_process_events(&this_arg_conv);
22648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
22649 LDKPeerManager this_arg_conv;
22650 this_arg_conv.inner = (void*)(this_arg & (~1));
22651 this_arg_conv.is_owned = false;
22652 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22653 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
22656 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) {
22657 LDKPeerManager this_arg_conv;
22658 this_arg_conv.inner = (void*)(this_arg & (~1));
22659 this_arg_conv.is_owned = false;
22660 LDKPublicKey node_id_ref;
22661 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22662 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22663 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
22666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
22667 LDKPeerManager this_arg_conv;
22668 this_arg_conv.inner = (void*)(this_arg & (~1));
22669 this_arg_conv.is_owned = false;
22670 PeerManager_timer_tick_occurred(&this_arg_conv);
22673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
22674 unsigned char commitment_seed_arr[32];
22675 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
22676 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
22677 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
22678 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22679 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
22683 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) {
22684 LDKPublicKey per_commitment_point_ref;
22685 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22686 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22687 unsigned char base_secret_arr[32];
22688 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
22689 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
22690 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
22691 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22692 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
22693 return (uint64_t)ret_conv;
22696 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) {
22697 LDKPublicKey per_commitment_point_ref;
22698 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22699 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22700 LDKPublicKey base_point_ref;
22701 CHECK((*env)->GetArrayLength(env, base_point) == 33);
22702 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
22703 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22704 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
22705 return (uint64_t)ret_conv;
22708 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) {
22709 unsigned char per_commitment_secret_arr[32];
22710 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
22711 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
22712 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
22713 unsigned char countersignatory_revocation_base_secret_arr[32];
22714 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
22715 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
22716 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
22717 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22718 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
22719 return (uint64_t)ret_conv;
22722 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) {
22723 LDKPublicKey per_commitment_point_ref;
22724 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22725 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22726 LDKPublicKey countersignatory_revocation_base_point_ref;
22727 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
22728 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
22729 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22730 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
22731 return (uint64_t)ret_conv;
22734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22735 LDKTxCreationKeys this_obj_conv;
22736 this_obj_conv.inner = (void*)(this_obj & (~1));
22737 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22738 TxCreationKeys_free(this_obj_conv);
22741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22742 LDKTxCreationKeys this_ptr_conv;
22743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22744 this_ptr_conv.is_owned = false;
22745 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22746 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
22750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22751 LDKTxCreationKeys this_ptr_conv;
22752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22753 this_ptr_conv.is_owned = false;
22754 LDKPublicKey val_ref;
22755 CHECK((*env)->GetArrayLength(env, val) == 33);
22756 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22757 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
22760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22761 LDKTxCreationKeys this_ptr_conv;
22762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22763 this_ptr_conv.is_owned = false;
22764 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22765 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
22769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22770 LDKTxCreationKeys this_ptr_conv;
22771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22772 this_ptr_conv.is_owned = false;
22773 LDKPublicKey val_ref;
22774 CHECK((*env)->GetArrayLength(env, val) == 33);
22775 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22776 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
22779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22780 LDKTxCreationKeys this_ptr_conv;
22781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22782 this_ptr_conv.is_owned = false;
22783 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
22788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22789 LDKTxCreationKeys this_ptr_conv;
22790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22791 this_ptr_conv.is_owned = false;
22792 LDKPublicKey val_ref;
22793 CHECK((*env)->GetArrayLength(env, val) == 33);
22794 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22795 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
22798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22799 LDKTxCreationKeys this_ptr_conv;
22800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22801 this_ptr_conv.is_owned = false;
22802 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22803 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
22807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22808 LDKTxCreationKeys this_ptr_conv;
22809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22810 this_ptr_conv.is_owned = false;
22811 LDKPublicKey val_ref;
22812 CHECK((*env)->GetArrayLength(env, val) == 33);
22813 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22814 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
22817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22818 LDKTxCreationKeys this_ptr_conv;
22819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22820 this_ptr_conv.is_owned = false;
22821 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
22826 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) {
22827 LDKTxCreationKeys this_ptr_conv;
22828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22829 this_ptr_conv.is_owned = false;
22830 LDKPublicKey val_ref;
22831 CHECK((*env)->GetArrayLength(env, val) == 33);
22832 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22833 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
22836 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) {
22837 LDKPublicKey per_commitment_point_arg_ref;
22838 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
22839 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
22840 LDKPublicKey revocation_key_arg_ref;
22841 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
22842 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
22843 LDKPublicKey broadcaster_htlc_key_arg_ref;
22844 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
22845 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
22846 LDKPublicKey countersignatory_htlc_key_arg_ref;
22847 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
22848 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
22849 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
22850 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
22851 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
22852 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);
22853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22855 uint64_t ret_ref = (uint64_t)ret_var.inner;
22856 if (ret_var.is_owned) {
22862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22863 LDKTxCreationKeys orig_conv;
22864 orig_conv.inner = (void*)(orig & (~1));
22865 orig_conv.is_owned = false;
22866 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
22867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22869 uint64_t ret_ref = (uint64_t)ret_var.inner;
22870 if (ret_var.is_owned) {
22876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
22877 LDKTxCreationKeys obj_conv;
22878 obj_conv.inner = (void*)(obj & (~1));
22879 obj_conv.is_owned = false;
22880 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
22881 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22882 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22883 CVec_u8Z_free(ret_var);
22887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22888 LDKu8slice ser_ref;
22889 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22890 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22891 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
22892 *ret_conv = TxCreationKeys_read(ser_ref);
22893 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22894 return (uint64_t)ret_conv;
22897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22898 LDKChannelPublicKeys this_obj_conv;
22899 this_obj_conv.inner = (void*)(this_obj & (~1));
22900 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22901 ChannelPublicKeys_free(this_obj_conv);
22904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22905 LDKChannelPublicKeys this_ptr_conv;
22906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22907 this_ptr_conv.is_owned = false;
22908 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22909 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
22913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22914 LDKChannelPublicKeys this_ptr_conv;
22915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22916 this_ptr_conv.is_owned = false;
22917 LDKPublicKey val_ref;
22918 CHECK((*env)->GetArrayLength(env, val) == 33);
22919 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22920 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
22923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22924 LDKChannelPublicKeys this_ptr_conv;
22925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22926 this_ptr_conv.is_owned = false;
22927 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22928 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
22932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22933 LDKChannelPublicKeys this_ptr_conv;
22934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22935 this_ptr_conv.is_owned = false;
22936 LDKPublicKey val_ref;
22937 CHECK((*env)->GetArrayLength(env, val) == 33);
22938 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22939 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
22942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22943 LDKChannelPublicKeys this_ptr_conv;
22944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22945 this_ptr_conv.is_owned = false;
22946 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
22951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22952 LDKChannelPublicKeys this_ptr_conv;
22953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22954 this_ptr_conv.is_owned = false;
22955 LDKPublicKey val_ref;
22956 CHECK((*env)->GetArrayLength(env, val) == 33);
22957 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22958 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
22961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22962 LDKChannelPublicKeys this_ptr_conv;
22963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22964 this_ptr_conv.is_owned = false;
22965 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22966 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
22970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22971 LDKChannelPublicKeys this_ptr_conv;
22972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22973 this_ptr_conv.is_owned = false;
22974 LDKPublicKey val_ref;
22975 CHECK((*env)->GetArrayLength(env, val) == 33);
22976 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22977 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22981 LDKChannelPublicKeys this_ptr_conv;
22982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22983 this_ptr_conv.is_owned = false;
22984 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
22989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22990 LDKChannelPublicKeys this_ptr_conv;
22991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22992 this_ptr_conv.is_owned = false;
22993 LDKPublicKey val_ref;
22994 CHECK((*env)->GetArrayLength(env, val) == 33);
22995 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22996 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
22999 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) {
23000 LDKPublicKey funding_pubkey_arg_ref;
23001 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
23002 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
23003 LDKPublicKey revocation_basepoint_arg_ref;
23004 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
23005 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
23006 LDKPublicKey payment_point_arg_ref;
23007 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
23008 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
23009 LDKPublicKey delayed_payment_basepoint_arg_ref;
23010 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
23011 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
23012 LDKPublicKey htlc_basepoint_arg_ref;
23013 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
23014 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
23015 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);
23016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23018 uint64_t ret_ref = (uint64_t)ret_var.inner;
23019 if (ret_var.is_owned) {
23025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23026 LDKChannelPublicKeys orig_conv;
23027 orig_conv.inner = (void*)(orig & (~1));
23028 orig_conv.is_owned = false;
23029 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
23030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23032 uint64_t ret_ref = (uint64_t)ret_var.inner;
23033 if (ret_var.is_owned) {
23039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
23040 LDKChannelPublicKeys obj_conv;
23041 obj_conv.inner = (void*)(obj & (~1));
23042 obj_conv.is_owned = false;
23043 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
23044 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23045 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23046 CVec_u8Z_free(ret_var);
23050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23051 LDKu8slice ser_ref;
23052 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23053 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23054 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
23055 *ret_conv = ChannelPublicKeys_read(ser_ref);
23056 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23057 return (uint64_t)ret_conv;
23060 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) {
23061 LDKPublicKey per_commitment_point_ref;
23062 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
23063 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
23064 LDKPublicKey broadcaster_delayed_payment_base_ref;
23065 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
23066 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
23067 LDKPublicKey broadcaster_htlc_base_ref;
23068 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
23069 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
23070 LDKPublicKey countersignatory_revocation_base_ref;
23071 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
23072 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
23073 LDKPublicKey countersignatory_htlc_base_ref;
23074 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
23075 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
23076 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
23077 *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);
23078 return (uint64_t)ret_conv;
23081 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) {
23082 LDKPublicKey per_commitment_point_ref;
23083 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
23084 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
23085 LDKChannelPublicKeys broadcaster_keys_conv;
23086 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23087 broadcaster_keys_conv.is_owned = false;
23088 LDKChannelPublicKeys countersignatory_keys_conv;
23089 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23090 countersignatory_keys_conv.is_owned = false;
23091 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
23092 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
23093 return (uint64_t)ret_conv;
23096 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) {
23097 LDKPublicKey revocation_key_ref;
23098 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
23099 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
23100 LDKPublicKey broadcaster_delayed_payment_key_ref;
23101 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
23102 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
23103 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
23104 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23105 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23106 CVec_u8Z_free(ret_var);
23110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23111 LDKHTLCOutputInCommitment this_obj_conv;
23112 this_obj_conv.inner = (void*)(this_obj & (~1));
23113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23114 HTLCOutputInCommitment_free(this_obj_conv);
23117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
23118 LDKHTLCOutputInCommitment this_ptr_conv;
23119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23120 this_ptr_conv.is_owned = false;
23121 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
23125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23126 LDKHTLCOutputInCommitment this_ptr_conv;
23127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23128 this_ptr_conv.is_owned = false;
23129 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
23132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23133 LDKHTLCOutputInCommitment this_ptr_conv;
23134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23135 this_ptr_conv.is_owned = false;
23136 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
23140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23141 LDKHTLCOutputInCommitment this_ptr_conv;
23142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23143 this_ptr_conv.is_owned = false;
23144 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
23147 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
23148 LDKHTLCOutputInCommitment this_ptr_conv;
23149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23150 this_ptr_conv.is_owned = false;
23151 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
23155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23156 LDKHTLCOutputInCommitment this_ptr_conv;
23157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23158 this_ptr_conv.is_owned = false;
23159 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
23162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23163 LDKHTLCOutputInCommitment this_ptr_conv;
23164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23165 this_ptr_conv.is_owned = false;
23166 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23167 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
23171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23172 LDKHTLCOutputInCommitment this_ptr_conv;
23173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23174 this_ptr_conv.is_owned = false;
23175 LDKThirtyTwoBytes val_ref;
23176 CHECK((*env)->GetArrayLength(env, val) == 32);
23177 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23178 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
23181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
23182 LDKHTLCOutputInCommitment this_ptr_conv;
23183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23184 this_ptr_conv.is_owned = false;
23185 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23186 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
23187 uint64_t ret_ref = (uint64_t)ret_copy;
23191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23192 LDKHTLCOutputInCommitment this_ptr_conv;
23193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23194 this_ptr_conv.is_owned = false;
23195 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
23196 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
23199 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) {
23200 LDKThirtyTwoBytes payment_hash_arg_ref;
23201 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
23202 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
23203 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
23204 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
23205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23207 uint64_t ret_ref = (uint64_t)ret_var.inner;
23208 if (ret_var.is_owned) {
23214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23215 LDKHTLCOutputInCommitment orig_conv;
23216 orig_conv.inner = (void*)(orig & (~1));
23217 orig_conv.is_owned = false;
23218 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
23219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23221 uint64_t ret_ref = (uint64_t)ret_var.inner;
23222 if (ret_var.is_owned) {
23228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
23229 LDKHTLCOutputInCommitment obj_conv;
23230 obj_conv.inner = (void*)(obj & (~1));
23231 obj_conv.is_owned = false;
23232 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
23233 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23234 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23235 CVec_u8Z_free(ret_var);
23239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23240 LDKu8slice ser_ref;
23241 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23242 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23243 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
23244 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
23245 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23246 return (uint64_t)ret_conv;
23249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
23250 LDKHTLCOutputInCommitment htlc_conv;
23251 htlc_conv.inner = (void*)(htlc & (~1));
23252 htlc_conv.is_owned = false;
23253 LDKTxCreationKeys keys_conv;
23254 keys_conv.inner = (void*)(keys & (~1));
23255 keys_conv.is_owned = false;
23256 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
23257 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23258 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23259 CVec_u8Z_free(ret_var);
23263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
23264 LDKPublicKey broadcaster_ref;
23265 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
23266 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
23267 LDKPublicKey countersignatory_ref;
23268 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
23269 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
23270 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
23271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23273 CVec_u8Z_free(ret_var);
23277 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) {
23278 unsigned char commitment_txid_arr[32];
23279 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
23280 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
23281 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
23282 LDKHTLCOutputInCommitment htlc_conv;
23283 htlc_conv.inner = (void*)(htlc & (~1));
23284 htlc_conv.is_owned = false;
23285 LDKPublicKey broadcaster_delayed_payment_key_ref;
23286 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
23287 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
23288 LDKPublicKey revocation_key_ref;
23289 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
23290 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
23291 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
23292 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23293 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23294 Transaction_free(ret_var);
23298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23299 LDKChannelTransactionParameters this_obj_conv;
23300 this_obj_conv.inner = (void*)(this_obj & (~1));
23301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23302 ChannelTransactionParameters_free(this_obj_conv);
23305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
23306 LDKChannelTransactionParameters this_ptr_conv;
23307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23308 this_ptr_conv.is_owned = false;
23309 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
23310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23312 uint64_t ret_ref = (uint64_t)ret_var.inner;
23313 if (ret_var.is_owned) {
23319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23320 LDKChannelTransactionParameters this_ptr_conv;
23321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23322 this_ptr_conv.is_owned = false;
23323 LDKChannelPublicKeys val_conv;
23324 val_conv.inner = (void*)(val & (~1));
23325 val_conv.is_owned = (val & 1) || (val == 0);
23326 val_conv = ChannelPublicKeys_clone(&val_conv);
23327 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
23330 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23331 LDKChannelTransactionParameters this_ptr_conv;
23332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23333 this_ptr_conv.is_owned = false;
23334 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
23338 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) {
23339 LDKChannelTransactionParameters this_ptr_conv;
23340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23341 this_ptr_conv.is_owned = false;
23342 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
23345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
23346 LDKChannelTransactionParameters this_ptr_conv;
23347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23348 this_ptr_conv.is_owned = false;
23349 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
23353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23354 LDKChannelTransactionParameters this_ptr_conv;
23355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23356 this_ptr_conv.is_owned = false;
23357 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
23360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
23361 LDKChannelTransactionParameters this_ptr_conv;
23362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23363 this_ptr_conv.is_owned = false;
23364 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
23365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23367 uint64_t ret_ref = (uint64_t)ret_var.inner;
23368 if (ret_var.is_owned) {
23374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23375 LDKChannelTransactionParameters this_ptr_conv;
23376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23377 this_ptr_conv.is_owned = false;
23378 LDKCounterpartyChannelTransactionParameters val_conv;
23379 val_conv.inner = (void*)(val & (~1));
23380 val_conv.is_owned = (val & 1) || (val == 0);
23381 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
23382 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
23385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
23386 LDKChannelTransactionParameters this_ptr_conv;
23387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23388 this_ptr_conv.is_owned = false;
23389 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
23390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23392 uint64_t ret_ref = (uint64_t)ret_var.inner;
23393 if (ret_var.is_owned) {
23399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23400 LDKChannelTransactionParameters this_ptr_conv;
23401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23402 this_ptr_conv.is_owned = false;
23403 LDKOutPoint val_conv;
23404 val_conv.inner = (void*)(val & (~1));
23405 val_conv.is_owned = (val & 1) || (val == 0);
23406 val_conv = OutPoint_clone(&val_conv);
23407 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
23410 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) {
23411 LDKChannelPublicKeys holder_pubkeys_arg_conv;
23412 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
23413 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
23414 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
23415 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
23416 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
23417 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
23418 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
23419 LDKOutPoint funding_outpoint_arg_conv;
23420 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
23421 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
23422 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
23423 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);
23424 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23425 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23426 uint64_t ret_ref = (uint64_t)ret_var.inner;
23427 if (ret_var.is_owned) {
23433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23434 LDKChannelTransactionParameters orig_conv;
23435 orig_conv.inner = (void*)(orig & (~1));
23436 orig_conv.is_owned = false;
23437 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
23438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23440 uint64_t ret_ref = (uint64_t)ret_var.inner;
23441 if (ret_var.is_owned) {
23447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23448 LDKCounterpartyChannelTransactionParameters this_obj_conv;
23449 this_obj_conv.inner = (void*)(this_obj & (~1));
23450 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23451 CounterpartyChannelTransactionParameters_free(this_obj_conv);
23454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
23455 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23457 this_ptr_conv.is_owned = false;
23458 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
23459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23461 uint64_t ret_ref = (uint64_t)ret_var.inner;
23462 if (ret_var.is_owned) {
23468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23469 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23471 this_ptr_conv.is_owned = false;
23472 LDKChannelPublicKeys val_conv;
23473 val_conv.inner = (void*)(val & (~1));
23474 val_conv.is_owned = (val & 1) || (val == 0);
23475 val_conv = ChannelPublicKeys_clone(&val_conv);
23476 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
23479 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23480 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23482 this_ptr_conv.is_owned = false;
23483 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
23487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23488 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23490 this_ptr_conv.is_owned = false;
23491 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
23494 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) {
23495 LDKChannelPublicKeys pubkeys_arg_conv;
23496 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
23497 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
23498 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
23499 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
23500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23502 uint64_t ret_ref = (uint64_t)ret_var.inner;
23503 if (ret_var.is_owned) {
23509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23510 LDKCounterpartyChannelTransactionParameters orig_conv;
23511 orig_conv.inner = (void*)(orig & (~1));
23512 orig_conv.is_owned = false;
23513 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
23514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23516 uint64_t ret_ref = (uint64_t)ret_var.inner;
23517 if (ret_var.is_owned) {
23523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
23524 LDKChannelTransactionParameters this_arg_conv;
23525 this_arg_conv.inner = (void*)(this_arg & (~1));
23526 this_arg_conv.is_owned = false;
23527 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
23531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
23532 LDKChannelTransactionParameters this_arg_conv;
23533 this_arg_conv.inner = (void*)(this_arg & (~1));
23534 this_arg_conv.is_owned = false;
23535 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
23536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23538 uint64_t ret_ref = (uint64_t)ret_var.inner;
23539 if (ret_var.is_owned) {
23545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
23546 LDKChannelTransactionParameters this_arg_conv;
23547 this_arg_conv.inner = (void*)(this_arg & (~1));
23548 this_arg_conv.is_owned = false;
23549 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
23550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23552 uint64_t ret_ref = (uint64_t)ret_var.inner;
23553 if (ret_var.is_owned) {
23559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
23560 LDKCounterpartyChannelTransactionParameters obj_conv;
23561 obj_conv.inner = (void*)(obj & (~1));
23562 obj_conv.is_owned = false;
23563 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
23564 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23565 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23566 CVec_u8Z_free(ret_var);
23570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23571 LDKu8slice ser_ref;
23572 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23573 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23574 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
23575 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
23576 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23577 return (uint64_t)ret_conv;
23580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
23581 LDKChannelTransactionParameters obj_conv;
23582 obj_conv.inner = (void*)(obj & (~1));
23583 obj_conv.is_owned = false;
23584 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
23585 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23586 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23587 CVec_u8Z_free(ret_var);
23591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23592 LDKu8slice ser_ref;
23593 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23594 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23595 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
23596 *ret_conv = ChannelTransactionParameters_read(ser_ref);
23597 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23598 return (uint64_t)ret_conv;
23601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23602 LDKDirectedChannelTransactionParameters this_obj_conv;
23603 this_obj_conv.inner = (void*)(this_obj & (~1));
23604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23605 DirectedChannelTransactionParameters_free(this_obj_conv);
23608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
23609 LDKDirectedChannelTransactionParameters this_arg_conv;
23610 this_arg_conv.inner = (void*)(this_arg & (~1));
23611 this_arg_conv.is_owned = false;
23612 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
23613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23615 uint64_t ret_ref = (uint64_t)ret_var.inner;
23616 if (ret_var.is_owned) {
23622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
23623 LDKDirectedChannelTransactionParameters this_arg_conv;
23624 this_arg_conv.inner = (void*)(this_arg & (~1));
23625 this_arg_conv.is_owned = false;
23626 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
23627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23629 uint64_t ret_ref = (uint64_t)ret_var.inner;
23630 if (ret_var.is_owned) {
23636 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
23637 LDKDirectedChannelTransactionParameters this_arg_conv;
23638 this_arg_conv.inner = (void*)(this_arg & (~1));
23639 this_arg_conv.is_owned = false;
23640 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
23644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
23645 LDKDirectedChannelTransactionParameters this_arg_conv;
23646 this_arg_conv.inner = (void*)(this_arg & (~1));
23647 this_arg_conv.is_owned = false;
23648 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
23652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
23653 LDKDirectedChannelTransactionParameters this_arg_conv;
23654 this_arg_conv.inner = (void*)(this_arg & (~1));
23655 this_arg_conv.is_owned = false;
23656 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
23657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23659 uint64_t ret_ref = (uint64_t)ret_var.inner;
23660 if (ret_var.is_owned) {
23666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23667 LDKHolderCommitmentTransaction this_obj_conv;
23668 this_obj_conv.inner = (void*)(this_obj & (~1));
23669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23670 HolderCommitmentTransaction_free(this_obj_conv);
23673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
23674 LDKHolderCommitmentTransaction this_ptr_conv;
23675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23676 this_ptr_conv.is_owned = false;
23677 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23678 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
23682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23683 LDKHolderCommitmentTransaction this_ptr_conv;
23684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23685 this_ptr_conv.is_owned = false;
23686 LDKSignature val_ref;
23687 CHECK((*env)->GetArrayLength(env, val) == 64);
23688 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23689 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
23692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23693 LDKHolderCommitmentTransaction this_ptr_conv;
23694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23695 this_ptr_conv.is_owned = false;
23696 LDKCVec_SignatureZ val_constr;
23697 val_constr.datalen = (*env)->GetArrayLength(env, val);
23698 if (val_constr.datalen > 0)
23699 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23701 val_constr.data = NULL;
23702 for (size_t i = 0; i < val_constr.datalen; i++) {
23703 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
23704 LDKSignature val_conv_8_ref;
23705 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
23706 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
23707 val_constr.data[i] = val_conv_8_ref;
23709 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
23712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23713 LDKHolderCommitmentTransaction orig_conv;
23714 orig_conv.inner = (void*)(orig & (~1));
23715 orig_conv.is_owned = false;
23716 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
23717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23719 uint64_t ret_ref = (uint64_t)ret_var.inner;
23720 if (ret_var.is_owned) {
23726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23727 LDKHolderCommitmentTransaction obj_conv;
23728 obj_conv.inner = (void*)(obj & (~1));
23729 obj_conv.is_owned = false;
23730 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
23731 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23732 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23733 CVec_u8Z_free(ret_var);
23737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23738 LDKu8slice ser_ref;
23739 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23740 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23741 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
23742 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
23743 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23744 return (uint64_t)ret_conv;
23747 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) {
23748 LDKCommitmentTransaction commitment_tx_conv;
23749 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
23750 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
23751 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
23752 LDKSignature counterparty_sig_ref;
23753 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
23754 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
23755 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
23756 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
23757 if (counterparty_htlc_sigs_constr.datalen > 0)
23758 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23760 counterparty_htlc_sigs_constr.data = NULL;
23761 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
23762 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
23763 LDKSignature counterparty_htlc_sigs_conv_8_ref;
23764 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
23765 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
23766 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
23768 LDKPublicKey holder_funding_key_ref;
23769 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
23770 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
23771 LDKPublicKey counterparty_funding_key_ref;
23772 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
23773 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
23774 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
23775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23777 uint64_t ret_ref = (uint64_t)ret_var.inner;
23778 if (ret_var.is_owned) {
23784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23785 LDKBuiltCommitmentTransaction this_obj_conv;
23786 this_obj_conv.inner = (void*)(this_obj & (~1));
23787 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23788 BuiltCommitmentTransaction_free(this_obj_conv);
23791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
23792 LDKBuiltCommitmentTransaction this_ptr_conv;
23793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23794 this_ptr_conv.is_owned = false;
23795 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
23796 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23797 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23798 Transaction_free(ret_var);
23802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23803 LDKBuiltCommitmentTransaction this_ptr_conv;
23804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23805 this_ptr_conv.is_owned = false;
23806 LDKTransaction val_ref;
23807 val_ref.datalen = (*env)->GetArrayLength(env, val);
23808 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
23809 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
23810 val_ref.data_is_owned = true;
23811 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
23814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
23815 LDKBuiltCommitmentTransaction this_ptr_conv;
23816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23817 this_ptr_conv.is_owned = false;
23818 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
23823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23824 LDKBuiltCommitmentTransaction this_ptr_conv;
23825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23826 this_ptr_conv.is_owned = false;
23827 LDKThirtyTwoBytes val_ref;
23828 CHECK((*env)->GetArrayLength(env, val) == 32);
23829 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23830 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
23833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
23834 LDKTransaction transaction_arg_ref;
23835 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
23836 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
23837 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
23838 transaction_arg_ref.data_is_owned = true;
23839 LDKThirtyTwoBytes txid_arg_ref;
23840 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
23841 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
23842 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
23843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23845 uint64_t ret_ref = (uint64_t)ret_var.inner;
23846 if (ret_var.is_owned) {
23852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23853 LDKBuiltCommitmentTransaction orig_conv;
23854 orig_conv.inner = (void*)(orig & (~1));
23855 orig_conv.is_owned = false;
23856 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
23857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23859 uint64_t ret_ref = (uint64_t)ret_var.inner;
23860 if (ret_var.is_owned) {
23866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23867 LDKBuiltCommitmentTransaction obj_conv;
23868 obj_conv.inner = (void*)(obj & (~1));
23869 obj_conv.is_owned = false;
23870 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
23871 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23872 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23873 CVec_u8Z_free(ret_var);
23877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23878 LDKu8slice ser_ref;
23879 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23880 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23881 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
23882 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
23883 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23884 return (uint64_t)ret_conv;
23887 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) {
23888 LDKBuiltCommitmentTransaction this_arg_conv;
23889 this_arg_conv.inner = (void*)(this_arg & (~1));
23890 this_arg_conv.is_owned = false;
23891 LDKu8slice funding_redeemscript_ref;
23892 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
23893 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
23894 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
23896 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
23900 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) {
23901 LDKBuiltCommitmentTransaction this_arg_conv;
23902 this_arg_conv.inner = (void*)(this_arg & (~1));
23903 this_arg_conv.is_owned = false;
23904 unsigned char funding_key_arr[32];
23905 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
23906 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
23907 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23908 LDKu8slice funding_redeemscript_ref;
23909 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
23910 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
23911 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
23913 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
23917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23918 LDKCommitmentTransaction this_obj_conv;
23919 this_obj_conv.inner = (void*)(this_obj & (~1));
23920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23921 CommitmentTransaction_free(this_obj_conv);
23924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23925 LDKCommitmentTransaction orig_conv;
23926 orig_conv.inner = (void*)(orig & (~1));
23927 orig_conv.is_owned = false;
23928 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
23929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23931 uint64_t ret_ref = (uint64_t)ret_var.inner;
23932 if (ret_var.is_owned) {
23938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23939 LDKCommitmentTransaction obj_conv;
23940 obj_conv.inner = (void*)(obj & (~1));
23941 obj_conv.is_owned = false;
23942 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
23943 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23944 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23945 CVec_u8Z_free(ret_var);
23949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23950 LDKu8slice ser_ref;
23951 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23952 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23953 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
23954 *ret_conv = CommitmentTransaction_read(ser_ref);
23955 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23956 return (uint64_t)ret_conv;
23959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
23960 LDKCommitmentTransaction this_arg_conv;
23961 this_arg_conv.inner = (void*)(this_arg & (~1));
23962 this_arg_conv.is_owned = false;
23963 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23968 LDKCommitmentTransaction this_arg_conv;
23969 this_arg_conv.inner = (void*)(this_arg & (~1));
23970 this_arg_conv.is_owned = false;
23971 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23976 LDKCommitmentTransaction this_arg_conv;
23977 this_arg_conv.inner = (void*)(this_arg & (~1));
23978 this_arg_conv.is_owned = false;
23979 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23983 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
23984 LDKCommitmentTransaction this_arg_conv;
23985 this_arg_conv.inner = (void*)(this_arg & (~1));
23986 this_arg_conv.is_owned = false;
23987 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
23992 LDKCommitmentTransaction this_arg_conv;
23993 this_arg_conv.inner = (void*)(this_arg & (~1));
23994 this_arg_conv.is_owned = false;
23995 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23998 uint64_t ret_ref = (uint64_t)ret_var.inner;
23999 if (ret_var.is_owned) {
24005 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) {
24006 LDKCommitmentTransaction this_arg_conv;
24007 this_arg_conv.inner = (void*)(this_arg & (~1));
24008 this_arg_conv.is_owned = false;
24009 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24010 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24011 channel_parameters_conv.is_owned = false;
24012 LDKChannelPublicKeys broadcaster_keys_conv;
24013 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24014 broadcaster_keys_conv.is_owned = false;
24015 LDKChannelPublicKeys countersignatory_keys_conv;
24016 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24017 countersignatory_keys_conv.is_owned = false;
24018 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
24019 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
24020 return (uint64_t)ret_conv;
24023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24024 LDKTrustedCommitmentTransaction this_obj_conv;
24025 this_obj_conv.inner = (void*)(this_obj & (~1));
24026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24027 TrustedCommitmentTransaction_free(this_obj_conv);
24030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
24031 LDKTrustedCommitmentTransaction this_arg_conv;
24032 this_arg_conv.inner = (void*)(this_arg & (~1));
24033 this_arg_conv.is_owned = false;
24034 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
24039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
24040 LDKTrustedCommitmentTransaction this_arg_conv;
24041 this_arg_conv.inner = (void*)(this_arg & (~1));
24042 this_arg_conv.is_owned = false;
24043 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
24044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24046 uint64_t ret_ref = (uint64_t)ret_var.inner;
24047 if (ret_var.is_owned) {
24053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
24054 LDKTrustedCommitmentTransaction this_arg_conv;
24055 this_arg_conv.inner = (void*)(this_arg & (~1));
24056 this_arg_conv.is_owned = false;
24057 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
24058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24060 uint64_t ret_ref = (uint64_t)ret_var.inner;
24061 if (ret_var.is_owned) {
24067 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) {
24068 LDKTrustedCommitmentTransaction this_arg_conv;
24069 this_arg_conv.inner = (void*)(this_arg & (~1));
24070 this_arg_conv.is_owned = false;
24071 unsigned char htlc_base_key_arr[32];
24072 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
24073 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
24074 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
24075 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24076 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24077 channel_parameters_conv.is_owned = false;
24078 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
24079 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
24080 return (uint64_t)ret_conv;
24083 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) {
24084 LDKPublicKey broadcaster_payment_basepoint_ref;
24085 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
24086 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
24087 LDKPublicKey countersignatory_payment_basepoint_ref;
24088 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
24089 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
24090 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
24094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24095 LDKInitFeatures a_conv;
24096 a_conv.inner = (void*)(a & (~1));
24097 a_conv.is_owned = false;
24098 LDKInitFeatures b_conv;
24099 b_conv.inner = (void*)(b & (~1));
24100 b_conv.is_owned = false;
24101 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
24105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24106 LDKNodeFeatures a_conv;
24107 a_conv.inner = (void*)(a & (~1));
24108 a_conv.is_owned = false;
24109 LDKNodeFeatures b_conv;
24110 b_conv.inner = (void*)(b & (~1));
24111 b_conv.is_owned = false;
24112 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
24116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24117 LDKChannelFeatures a_conv;
24118 a_conv.inner = (void*)(a & (~1));
24119 a_conv.is_owned = false;
24120 LDKChannelFeatures b_conv;
24121 b_conv.inner = (void*)(b & (~1));
24122 b_conv.is_owned = false;
24123 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
24127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24128 LDKInvoiceFeatures a_conv;
24129 a_conv.inner = (void*)(a & (~1));
24130 a_conv.is_owned = false;
24131 LDKInvoiceFeatures b_conv;
24132 b_conv.inner = (void*)(b & (~1));
24133 b_conv.is_owned = false;
24134 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
24138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24139 LDKInitFeatures orig_conv;
24140 orig_conv.inner = (void*)(orig & (~1));
24141 orig_conv.is_owned = false;
24142 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
24143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24145 uint64_t ret_ref = (uint64_t)ret_var.inner;
24146 if (ret_var.is_owned) {
24152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24153 LDKNodeFeatures orig_conv;
24154 orig_conv.inner = (void*)(orig & (~1));
24155 orig_conv.is_owned = false;
24156 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
24157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24159 uint64_t ret_ref = (uint64_t)ret_var.inner;
24160 if (ret_var.is_owned) {
24166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24167 LDKChannelFeatures orig_conv;
24168 orig_conv.inner = (void*)(orig & (~1));
24169 orig_conv.is_owned = false;
24170 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
24171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24173 uint64_t ret_ref = (uint64_t)ret_var.inner;
24174 if (ret_var.is_owned) {
24180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24181 LDKInvoiceFeatures orig_conv;
24182 orig_conv.inner = (void*)(orig & (~1));
24183 orig_conv.is_owned = false;
24184 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
24185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24187 uint64_t ret_ref = (uint64_t)ret_var.inner;
24188 if (ret_var.is_owned) {
24194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24195 LDKInitFeatures this_obj_conv;
24196 this_obj_conv.inner = (void*)(this_obj & (~1));
24197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24198 InitFeatures_free(this_obj_conv);
24201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24202 LDKNodeFeatures this_obj_conv;
24203 this_obj_conv.inner = (void*)(this_obj & (~1));
24204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24205 NodeFeatures_free(this_obj_conv);
24208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24209 LDKChannelFeatures this_obj_conv;
24210 this_obj_conv.inner = (void*)(this_obj & (~1));
24211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24212 ChannelFeatures_free(this_obj_conv);
24215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24216 LDKInvoiceFeatures this_obj_conv;
24217 this_obj_conv.inner = (void*)(this_obj & (~1));
24218 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24219 InvoiceFeatures_free(this_obj_conv);
24222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
24223 LDKInitFeatures ret_var = InitFeatures_empty();
24224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24226 uint64_t ret_ref = (uint64_t)ret_var.inner;
24227 if (ret_var.is_owned) {
24233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
24234 LDKInitFeatures ret_var = InitFeatures_known();
24235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24237 uint64_t ret_ref = (uint64_t)ret_var.inner;
24238 if (ret_var.is_owned) {
24244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
24245 LDKNodeFeatures ret_var = NodeFeatures_empty();
24246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24248 uint64_t ret_ref = (uint64_t)ret_var.inner;
24249 if (ret_var.is_owned) {
24255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
24256 LDKNodeFeatures ret_var = NodeFeatures_known();
24257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24259 uint64_t ret_ref = (uint64_t)ret_var.inner;
24260 if (ret_var.is_owned) {
24266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
24267 LDKChannelFeatures ret_var = ChannelFeatures_empty();
24268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24270 uint64_t ret_ref = (uint64_t)ret_var.inner;
24271 if (ret_var.is_owned) {
24277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
24278 LDKChannelFeatures ret_var = ChannelFeatures_known();
24279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24281 uint64_t ret_ref = (uint64_t)ret_var.inner;
24282 if (ret_var.is_owned) {
24288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
24289 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
24290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24292 uint64_t ret_ref = (uint64_t)ret_var.inner;
24293 if (ret_var.is_owned) {
24299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
24300 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
24301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24303 uint64_t ret_ref = (uint64_t)ret_var.inner;
24304 if (ret_var.is_owned) {
24310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24311 LDKInitFeatures this_arg_conv;
24312 this_arg_conv.inner = (void*)(this_arg & (~1));
24313 this_arg_conv.is_owned = false;
24314 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
24318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24319 LDKNodeFeatures this_arg_conv;
24320 this_arg_conv.inner = (void*)(this_arg & (~1));
24321 this_arg_conv.is_owned = false;
24322 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
24326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24327 LDKInvoiceFeatures this_arg_conv;
24328 this_arg_conv.inner = (void*)(this_arg & (~1));
24329 this_arg_conv.is_owned = false;
24330 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
24334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24335 LDKInitFeatures obj_conv;
24336 obj_conv.inner = (void*)(obj & (~1));
24337 obj_conv.is_owned = false;
24338 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
24339 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24340 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24341 CVec_u8Z_free(ret_var);
24345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24346 LDKNodeFeatures obj_conv;
24347 obj_conv.inner = (void*)(obj & (~1));
24348 obj_conv.is_owned = false;
24349 LDKCVec_u8Z ret_var = NodeFeatures_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24357 LDKChannelFeatures obj_conv;
24358 obj_conv.inner = (void*)(obj & (~1));
24359 obj_conv.is_owned = false;
24360 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
24361 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24362 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24363 CVec_u8Z_free(ret_var);
24367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24368 LDKInvoiceFeatures obj_conv;
24369 obj_conv.inner = (void*)(obj & (~1));
24370 obj_conv.is_owned = false;
24371 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
24372 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24373 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24374 CVec_u8Z_free(ret_var);
24378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24379 LDKu8slice ser_ref;
24380 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24381 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24382 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24383 *ret_conv = InitFeatures_read(ser_ref);
24384 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24385 return (uint64_t)ret_conv;
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24389 LDKu8slice ser_ref;
24390 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24391 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24392 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24393 *ret_conv = NodeFeatures_read(ser_ref);
24394 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24395 return (uint64_t)ret_conv;
24398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24399 LDKu8slice ser_ref;
24400 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24401 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24402 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24403 *ret_conv = ChannelFeatures_read(ser_ref);
24404 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24405 return (uint64_t)ret_conv;
24408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24409 LDKu8slice ser_ref;
24410 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24411 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24412 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
24413 *ret_conv = InvoiceFeatures_read(ser_ref);
24414 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24415 return (uint64_t)ret_conv;
24418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24419 LDKShutdownScript this_obj_conv;
24420 this_obj_conv.inner = (void*)(this_obj & (~1));
24421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24422 ShutdownScript_free(this_obj_conv);
24425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24426 LDKShutdownScript orig_conv;
24427 orig_conv.inner = (void*)(orig & (~1));
24428 orig_conv.is_owned = false;
24429 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
24430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24432 uint64_t ret_ref = (uint64_t)ret_var.inner;
24433 if (ret_var.is_owned) {
24439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24440 LDKInvalidShutdownScript this_obj_conv;
24441 this_obj_conv.inner = (void*)(this_obj & (~1));
24442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24443 InvalidShutdownScript_free(this_obj_conv);
24446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
24447 LDKInvalidShutdownScript this_ptr_conv;
24448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24449 this_ptr_conv.is_owned = false;
24450 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
24451 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24452 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24457 LDKInvalidShutdownScript this_ptr_conv;
24458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24459 this_ptr_conv.is_owned = false;
24460 LDKCVec_u8Z val_ref;
24461 val_ref.datalen = (*env)->GetArrayLength(env, val);
24462 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24463 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
24464 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
24467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
24468 LDKCVec_u8Z script_arg_ref;
24469 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
24470 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24471 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
24472 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
24473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24475 uint64_t ret_ref = (uint64_t)ret_var.inner;
24476 if (ret_var.is_owned) {
24482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
24483 LDKShutdownScript obj_conv;
24484 obj_conv.inner = (void*)(obj & (~1));
24485 obj_conv.is_owned = false;
24486 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
24487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24489 CVec_u8Z_free(ret_var);
24493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24494 LDKu8slice ser_ref;
24495 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24496 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24497 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
24498 *ret_conv = ShutdownScript_read(ser_ref);
24499 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24500 return (uint64_t)ret_conv;
24503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
24504 unsigned char pubkey_hash_arr[20];
24505 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
24506 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
24507 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24508 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
24509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24511 uint64_t ret_ref = (uint64_t)ret_var.inner;
24512 if (ret_var.is_owned) {
24518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
24519 unsigned char script_hash_arr[20];
24520 CHECK((*env)->GetArrayLength(env, script_hash) == 20);
24521 (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
24522 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
24523 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
24524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24526 uint64_t ret_ref = (uint64_t)ret_var.inner;
24527 if (ret_var.is_owned) {
24533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
24534 unsigned char pubkey_hash_arr[20];
24535 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
24536 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
24537 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24538 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
24539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24541 uint64_t ret_ref = (uint64_t)ret_var.inner;
24542 if (ret_var.is_owned) {
24548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
24549 unsigned char script_hash_arr[32];
24550 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
24551 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
24552 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
24553 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
24554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24556 uint64_t ret_ref = (uint64_t)ret_var.inner;
24557 if (ret_var.is_owned) {
24563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
24564 LDKu8slice program_ref;
24565 program_ref.datalen = (*env)->GetArrayLength(env, program);
24566 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
24567 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
24568 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
24569 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
24570 return (uint64_t)ret_conv;
24573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
24574 LDKShutdownScript this_arg_conv;
24575 this_arg_conv.inner = (void*)(this_arg & (~1));
24576 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24577 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
24578 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
24579 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24580 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24581 CVec_u8Z_free(ret_var);
24585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
24586 LDKShutdownScript this_arg_conv;
24587 this_arg_conv.inner = (void*)(this_arg & (~1));
24588 this_arg_conv.is_owned = false;
24589 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24590 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
24594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
24595 LDKShutdownScript this_arg_conv;
24596 this_arg_conv.inner = (void*)(this_arg & (~1));
24597 this_arg_conv.is_owned = false;
24598 LDKInitFeatures features_conv;
24599 features_conv.inner = (void*)(features & (~1));
24600 features_conv.is_owned = false;
24601 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
24605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24606 LDKRouteHop this_obj_conv;
24607 this_obj_conv.inner = (void*)(this_obj & (~1));
24608 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24609 RouteHop_free(this_obj_conv);
24612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24613 LDKRouteHop this_ptr_conv;
24614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24615 this_ptr_conv.is_owned = false;
24616 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24617 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
24621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24622 LDKRouteHop this_ptr_conv;
24623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24624 this_ptr_conv.is_owned = false;
24625 LDKPublicKey val_ref;
24626 CHECK((*env)->GetArrayLength(env, val) == 33);
24627 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24628 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
24631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24632 LDKRouteHop this_ptr_conv;
24633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24634 this_ptr_conv.is_owned = false;
24635 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
24636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24638 uint64_t ret_ref = (uint64_t)ret_var.inner;
24639 if (ret_var.is_owned) {
24645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24646 LDKRouteHop this_ptr_conv;
24647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24648 this_ptr_conv.is_owned = false;
24649 LDKNodeFeatures val_conv;
24650 val_conv.inner = (void*)(val & (~1));
24651 val_conv.is_owned = (val & 1) || (val == 0);
24652 val_conv = NodeFeatures_clone(&val_conv);
24653 RouteHop_set_node_features(&this_ptr_conv, val_conv);
24656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24657 LDKRouteHop this_ptr_conv;
24658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24659 this_ptr_conv.is_owned = false;
24660 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
24664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24665 LDKRouteHop this_ptr_conv;
24666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24667 this_ptr_conv.is_owned = false;
24668 RouteHop_set_short_channel_id(&this_ptr_conv, val);
24671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24672 LDKRouteHop this_ptr_conv;
24673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24674 this_ptr_conv.is_owned = false;
24675 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
24676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24678 uint64_t ret_ref = (uint64_t)ret_var.inner;
24679 if (ret_var.is_owned) {
24685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24686 LDKRouteHop this_ptr_conv;
24687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24688 this_ptr_conv.is_owned = false;
24689 LDKChannelFeatures val_conv;
24690 val_conv.inner = (void*)(val & (~1));
24691 val_conv.is_owned = (val & 1) || (val == 0);
24692 val_conv = ChannelFeatures_clone(&val_conv);
24693 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
24696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24697 LDKRouteHop this_ptr_conv;
24698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24699 this_ptr_conv.is_owned = false;
24700 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
24704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24705 LDKRouteHop this_ptr_conv;
24706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24707 this_ptr_conv.is_owned = false;
24708 RouteHop_set_fee_msat(&this_ptr_conv, val);
24711 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24712 LDKRouteHop this_ptr_conv;
24713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24714 this_ptr_conv.is_owned = false;
24715 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
24719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24720 LDKRouteHop this_ptr_conv;
24721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24722 this_ptr_conv.is_owned = false;
24723 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
24726 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) {
24727 LDKPublicKey pubkey_arg_ref;
24728 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
24729 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
24730 LDKNodeFeatures node_features_arg_conv;
24731 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
24732 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
24733 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
24734 LDKChannelFeatures channel_features_arg_conv;
24735 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
24736 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
24737 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
24738 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);
24739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24741 uint64_t ret_ref = (uint64_t)ret_var.inner;
24742 if (ret_var.is_owned) {
24748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24749 LDKRouteHop orig_conv;
24750 orig_conv.inner = (void*)(orig & (~1));
24751 orig_conv.is_owned = false;
24752 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
24753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24755 uint64_t ret_ref = (uint64_t)ret_var.inner;
24756 if (ret_var.is_owned) {
24762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
24763 LDKRouteHop obj_conv;
24764 obj_conv.inner = (void*)(obj & (~1));
24765 obj_conv.is_owned = false;
24766 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
24767 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24768 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24769 CVec_u8Z_free(ret_var);
24773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24774 LDKu8slice ser_ref;
24775 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24776 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24777 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24778 *ret_conv = RouteHop_read(ser_ref);
24779 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24780 return (uint64_t)ret_conv;
24783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24784 LDKRoute this_obj_conv;
24785 this_obj_conv.inner = (void*)(this_obj & (~1));
24786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24787 Route_free(this_obj_conv);
24790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
24791 LDKRoute this_ptr_conv;
24792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24793 this_ptr_conv.is_owned = false;
24794 LDKCVec_CVec_RouteHopZZ val_constr;
24795 val_constr.datalen = (*env)->GetArrayLength(env, val);
24796 if (val_constr.datalen > 0)
24797 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
24799 val_constr.data = NULL;
24800 for (size_t m = 0; m < val_constr.datalen; m++) {
24801 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
24802 LDKCVec_RouteHopZ val_conv_12_constr;
24803 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
24804 if (val_conv_12_constr.datalen > 0)
24805 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24807 val_conv_12_constr.data = NULL;
24808 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
24809 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
24810 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
24811 LDKRouteHop val_conv_12_conv_10_conv;
24812 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
24813 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
24814 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
24815 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
24817 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
24818 val_constr.data[m] = val_conv_12_constr;
24820 Route_set_paths(&this_ptr_conv, val_constr);
24823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
24824 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
24825 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
24826 if (paths_arg_constr.datalen > 0)
24827 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
24829 paths_arg_constr.data = NULL;
24830 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
24831 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
24832 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
24833 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
24834 if (paths_arg_conv_12_constr.datalen > 0)
24835 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24837 paths_arg_conv_12_constr.data = NULL;
24838 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
24839 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
24840 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
24841 LDKRouteHop paths_arg_conv_12_conv_10_conv;
24842 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
24843 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
24844 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
24845 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
24847 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
24848 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
24850 LDKRoute ret_var = Route_new(paths_arg_constr);
24851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24853 uint64_t ret_ref = (uint64_t)ret_var.inner;
24854 if (ret_var.is_owned) {
24860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24861 LDKRoute orig_conv;
24862 orig_conv.inner = (void*)(orig & (~1));
24863 orig_conv.is_owned = false;
24864 LDKRoute ret_var = Route_clone(&orig_conv);
24865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24867 uint64_t ret_ref = (uint64_t)ret_var.inner;
24868 if (ret_var.is_owned) {
24874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
24876 obj_conv.inner = (void*)(obj & (~1));
24877 obj_conv.is_owned = false;
24878 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
24879 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24880 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24881 CVec_u8Z_free(ret_var);
24885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24886 LDKu8slice ser_ref;
24887 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24888 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24889 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24890 *ret_conv = Route_read(ser_ref);
24891 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24892 return (uint64_t)ret_conv;
24895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24896 LDKRouteHint this_obj_conv;
24897 this_obj_conv.inner = (void*)(this_obj & (~1));
24898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24899 RouteHint_free(this_obj_conv);
24902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24903 LDKRouteHint a_conv;
24904 a_conv.inner = (void*)(a & (~1));
24905 a_conv.is_owned = false;
24906 LDKRouteHint b_conv;
24907 b_conv.inner = (void*)(b & (~1));
24908 b_conv.is_owned = false;
24909 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
24913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24914 LDKRouteHint orig_conv;
24915 orig_conv.inner = (void*)(orig & (~1));
24916 orig_conv.is_owned = false;
24917 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
24918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24920 uint64_t ret_ref = (uint64_t)ret_var.inner;
24921 if (ret_var.is_owned) {
24927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24928 LDKRouteHintHop this_obj_conv;
24929 this_obj_conv.inner = (void*)(this_obj & (~1));
24930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24931 RouteHintHop_free(this_obj_conv);
24934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24935 LDKRouteHintHop this_ptr_conv;
24936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24937 this_ptr_conv.is_owned = false;
24938 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24939 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
24943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24944 LDKRouteHintHop this_ptr_conv;
24945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24946 this_ptr_conv.is_owned = false;
24947 LDKPublicKey val_ref;
24948 CHECK((*env)->GetArrayLength(env, val) == 33);
24949 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24950 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
24953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24954 LDKRouteHintHop this_ptr_conv;
24955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24956 this_ptr_conv.is_owned = false;
24957 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
24961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24962 LDKRouteHintHop this_ptr_conv;
24963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24964 this_ptr_conv.is_owned = false;
24965 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
24968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24969 LDKRouteHintHop this_ptr_conv;
24970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24971 this_ptr_conv.is_owned = false;
24972 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
24973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24975 uint64_t ret_ref = (uint64_t)ret_var.inner;
24976 if (ret_var.is_owned) {
24982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24983 LDKRouteHintHop this_ptr_conv;
24984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24985 this_ptr_conv.is_owned = false;
24986 LDKRoutingFees val_conv;
24987 val_conv.inner = (void*)(val & (~1));
24988 val_conv.is_owned = (val & 1) || (val == 0);
24989 val_conv = RoutingFees_clone(&val_conv);
24990 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
24993 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24994 LDKRouteHintHop this_ptr_conv;
24995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24996 this_ptr_conv.is_owned = false;
24997 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
25001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25002 LDKRouteHintHop this_ptr_conv;
25003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25004 this_ptr_conv.is_owned = false;
25005 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
25008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25009 LDKRouteHintHop this_ptr_conv;
25010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25011 this_ptr_conv.is_owned = false;
25012 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25013 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
25014 uint64_t ret_ref = (uint64_t)ret_copy;
25018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25019 LDKRouteHintHop this_ptr_conv;
25020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25021 this_ptr_conv.is_owned = false;
25022 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25023 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
25026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25027 LDKRouteHintHop this_ptr_conv;
25028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25029 this_ptr_conv.is_owned = false;
25030 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25031 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
25032 uint64_t ret_ref = (uint64_t)ret_copy;
25036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25037 LDKRouteHintHop this_ptr_conv;
25038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25039 this_ptr_conv.is_owned = false;
25040 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25041 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
25044 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) {
25045 LDKPublicKey src_node_id_arg_ref;
25046 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
25047 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
25048 LDKRoutingFees fees_arg_conv;
25049 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25050 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25051 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25052 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
25053 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25054 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);
25055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25057 uint64_t ret_ref = (uint64_t)ret_var.inner;
25058 if (ret_var.is_owned) {
25064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25065 LDKRouteHintHop a_conv;
25066 a_conv.inner = (void*)(a & (~1));
25067 a_conv.is_owned = false;
25068 LDKRouteHintHop b_conv;
25069 b_conv.inner = (void*)(b & (~1));
25070 b_conv.is_owned = false;
25071 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
25075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25076 LDKRouteHintHop orig_conv;
25077 orig_conv.inner = (void*)(orig & (~1));
25078 orig_conv.is_owned = false;
25079 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
25080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25082 uint64_t ret_ref = (uint64_t)ret_var.inner;
25083 if (ret_var.is_owned) {
25089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
25090 LDKPublicKey our_node_id_ref;
25091 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
25092 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
25093 LDKNetworkGraph network_conv;
25094 network_conv.inner = (void*)(network & (~1));
25095 network_conv.is_owned = false;
25096 LDKPublicKey payee_ref;
25097 CHECK((*env)->GetArrayLength(env, payee) == 33);
25098 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
25099 LDKCVec_ChannelDetailsZ first_hops_constr;
25100 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25101 if (first_hops != NULL) {
25102 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
25103 if (first_hops_constr.datalen > 0)
25104 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25106 first_hops_constr.data = NULL;
25107 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
25108 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25109 int64_t first_hops_conv_16 = first_hops_vals[q];
25110 LDKChannelDetails first_hops_conv_16_conv;
25111 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25112 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25113 first_hops_constr.data[q] = first_hops_conv_16_conv;
25115 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
25116 first_hops_ptr = &first_hops_constr;
25118 LDKCVec_RouteHintZ last_hops_constr;
25119 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
25120 if (last_hops_constr.datalen > 0)
25121 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25123 last_hops_constr.data = NULL;
25124 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
25125 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25126 int64_t last_hops_conv_11 = last_hops_vals[l];
25127 LDKRouteHint last_hops_conv_11_conv;
25128 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25129 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25130 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25131 last_hops_constr.data[l] = last_hops_conv_11_conv;
25133 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
25134 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25135 if (logger_conv.free == LDKLogger_JCalls_free) {
25136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25137 LDKLogger_JCalls_cloned(&logger_conv);
25139 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25140 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
25141 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25142 return (uint64_t)ret_conv;
25145 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) {
25146 LDKPublicKey our_node_id_ref;
25147 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
25148 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
25149 LDKNetworkGraph network_conv;
25150 network_conv.inner = (void*)(network & (~1));
25151 network_conv.is_owned = false;
25152 LDKPublicKey payee_ref;
25153 CHECK((*env)->GetArrayLength(env, payee) == 33);
25154 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
25155 LDKInvoiceFeatures payee_features_conv;
25156 payee_features_conv.inner = (void*)(payee_features & (~1));
25157 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
25158 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
25159 LDKCVec_ChannelDetailsZ first_hops_constr;
25160 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25161 if (first_hops != NULL) {
25162 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
25163 if (first_hops_constr.datalen > 0)
25164 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25166 first_hops_constr.data = NULL;
25167 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
25168 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25169 int64_t first_hops_conv_16 = first_hops_vals[q];
25170 LDKChannelDetails first_hops_conv_16_conv;
25171 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25172 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25173 first_hops_constr.data[q] = first_hops_conv_16_conv;
25175 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
25176 first_hops_ptr = &first_hops_constr;
25178 LDKCVec_RouteHintZ last_hops_constr;
25179 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
25180 if (last_hops_constr.datalen > 0)
25181 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25183 last_hops_constr.data = NULL;
25184 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
25185 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25186 int64_t last_hops_conv_11 = last_hops_vals[l];
25187 LDKRouteHint last_hops_conv_11_conv;
25188 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25189 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25190 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25191 last_hops_constr.data[l] = last_hops_conv_11_conv;
25193 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
25194 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25195 if (logger_conv.free == LDKLogger_JCalls_free) {
25196 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25197 LDKLogger_JCalls_cloned(&logger_conv);
25199 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25200 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
25201 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25202 return (uint64_t)ret_conv;
25205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25206 LDKNetworkGraph this_obj_conv;
25207 this_obj_conv.inner = (void*)(this_obj & (~1));
25208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25209 NetworkGraph_free(this_obj_conv);
25212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25213 LDKNetworkGraph orig_conv;
25214 orig_conv.inner = (void*)(orig & (~1));
25215 orig_conv.is_owned = false;
25216 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
25217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25219 uint64_t ret_ref = (uint64_t)ret_var.inner;
25220 if (ret_var.is_owned) {
25226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25227 LDKLockedNetworkGraph this_obj_conv;
25228 this_obj_conv.inner = (void*)(this_obj & (~1));
25229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25230 LockedNetworkGraph_free(this_obj_conv);
25233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25234 LDKNetGraphMsgHandler this_obj_conv;
25235 this_obj_conv.inner = (void*)(this_obj & (~1));
25236 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25237 NetGraphMsgHandler_free(this_obj_conv);
25240 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) {
25241 LDKThirtyTwoBytes genesis_hash_ref;
25242 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
25243 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
25244 LDKAccess *chain_access_conv_ptr = NULL;
25245 if (chain_access != 0) {
25246 LDKAccess chain_access_conv;
25247 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25248 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25249 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25250 LDKAccess_JCalls_cloned(&chain_access_conv);
25252 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25253 *chain_access_conv_ptr = chain_access_conv;
25255 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25256 if (logger_conv.free == LDKLogger_JCalls_free) {
25257 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25258 LDKLogger_JCalls_cloned(&logger_conv);
25260 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
25261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25263 uint64_t ret_ref = (uint64_t)ret_var.inner;
25264 if (ret_var.is_owned) {
25270 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) {
25271 LDKAccess *chain_access_conv_ptr = NULL;
25272 if (chain_access != 0) {
25273 LDKAccess chain_access_conv;
25274 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25275 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25276 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25277 LDKAccess_JCalls_cloned(&chain_access_conv);
25279 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25280 *chain_access_conv_ptr = chain_access_conv;
25282 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25283 if (logger_conv.free == LDKLogger_JCalls_free) {
25284 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25285 LDKLogger_JCalls_cloned(&logger_conv);
25287 LDKNetworkGraph network_graph_conv;
25288 network_graph_conv.inner = (void*)(network_graph & (~1));
25289 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
25290 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
25291 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
25292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25294 uint64_t ret_ref = (uint64_t)ret_var.inner;
25295 if (ret_var.is_owned) {
25301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
25302 LDKNetGraphMsgHandler this_arg_conv;
25303 this_arg_conv.inner = (void*)(this_arg & (~1));
25304 this_arg_conv.is_owned = false;
25305 LDKAccess *chain_access_conv_ptr = NULL;
25306 if (chain_access != 0) {
25307 LDKAccess chain_access_conv;
25308 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25309 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25310 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25311 LDKAccess_JCalls_cloned(&chain_access_conv);
25313 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25314 *chain_access_conv_ptr = chain_access_conv;
25316 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
25319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
25320 LDKNetGraphMsgHandler this_arg_conv;
25321 this_arg_conv.inner = (void*)(this_arg & (~1));
25322 this_arg_conv.is_owned = false;
25323 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
25324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25326 uint64_t ret_ref = (uint64_t)ret_var.inner;
25327 if (ret_var.is_owned) {
25333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
25334 LDKLockedNetworkGraph this_arg_conv;
25335 this_arg_conv.inner = (void*)(this_arg & (~1));
25336 this_arg_conv.is_owned = false;
25337 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
25338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25340 uint64_t ret_ref = (uint64_t)ret_var.inner;
25341 if (ret_var.is_owned) {
25347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25348 LDKNetGraphMsgHandler this_arg_conv;
25349 this_arg_conv.inner = (void*)(this_arg & (~1));
25350 this_arg_conv.is_owned = false;
25351 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
25352 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
25353 return (uint64_t)ret;
25356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25357 LDKNetGraphMsgHandler this_arg_conv;
25358 this_arg_conv.inner = (void*)(this_arg & (~1));
25359 this_arg_conv.is_owned = false;
25360 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25361 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
25362 return (uint64_t)ret;
25365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25366 LDKDirectionalChannelInfo this_obj_conv;
25367 this_obj_conv.inner = (void*)(this_obj & (~1));
25368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25369 DirectionalChannelInfo_free(this_obj_conv);
25372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
25373 LDKDirectionalChannelInfo this_ptr_conv;
25374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25375 this_ptr_conv.is_owned = false;
25376 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
25380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25381 LDKDirectionalChannelInfo this_ptr_conv;
25382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25383 this_ptr_conv.is_owned = false;
25384 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
25387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
25388 LDKDirectionalChannelInfo this_ptr_conv;
25389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25390 this_ptr_conv.is_owned = false;
25391 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
25395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25396 LDKDirectionalChannelInfo this_ptr_conv;
25397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25398 this_ptr_conv.is_owned = false;
25399 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
25402 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25403 LDKDirectionalChannelInfo this_ptr_conv;
25404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25405 this_ptr_conv.is_owned = false;
25406 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
25410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25411 LDKDirectionalChannelInfo this_ptr_conv;
25412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25413 this_ptr_conv.is_owned = false;
25414 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
25417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25418 LDKDirectionalChannelInfo this_ptr_conv;
25419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25420 this_ptr_conv.is_owned = false;
25421 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
25425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25426 LDKDirectionalChannelInfo this_ptr_conv;
25427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25428 this_ptr_conv.is_owned = false;
25429 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
25432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25433 LDKDirectionalChannelInfo this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25437 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
25438 uint64_t ret_ref = (uint64_t)ret_copy;
25442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25443 LDKDirectionalChannelInfo this_ptr_conv;
25444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25445 this_ptr_conv.is_owned = false;
25446 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25447 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
25450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
25451 LDKDirectionalChannelInfo this_ptr_conv;
25452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25453 this_ptr_conv.is_owned = false;
25454 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
25455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25457 uint64_t ret_ref = (uint64_t)ret_var.inner;
25458 if (ret_var.is_owned) {
25464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25465 LDKDirectionalChannelInfo this_ptr_conv;
25466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25467 this_ptr_conv.is_owned = false;
25468 LDKRoutingFees val_conv;
25469 val_conv.inner = (void*)(val & (~1));
25470 val_conv.is_owned = (val & 1) || (val == 0);
25471 val_conv = RoutingFees_clone(&val_conv);
25472 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
25475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25476 LDKDirectionalChannelInfo this_ptr_conv;
25477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25478 this_ptr_conv.is_owned = false;
25479 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
25480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25482 uint64_t ret_ref = (uint64_t)ret_var.inner;
25483 if (ret_var.is_owned) {
25489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25490 LDKDirectionalChannelInfo this_ptr_conv;
25491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25492 this_ptr_conv.is_owned = false;
25493 LDKChannelUpdate val_conv;
25494 val_conv.inner = (void*)(val & (~1));
25495 val_conv.is_owned = (val & 1) || (val == 0);
25496 val_conv = ChannelUpdate_clone(&val_conv);
25497 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
25500 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) {
25501 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25502 LDKRoutingFees fees_arg_conv;
25503 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25504 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25505 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25506 LDKChannelUpdate last_update_message_arg_conv;
25507 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
25508 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
25509 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
25510 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);
25511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25513 uint64_t ret_ref = (uint64_t)ret_var.inner;
25514 if (ret_var.is_owned) {
25520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25521 LDKDirectionalChannelInfo orig_conv;
25522 orig_conv.inner = (void*)(orig & (~1));
25523 orig_conv.is_owned = false;
25524 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
25525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25527 uint64_t ret_ref = (uint64_t)ret_var.inner;
25528 if (ret_var.is_owned) {
25534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
25535 LDKDirectionalChannelInfo obj_conv;
25536 obj_conv.inner = (void*)(obj & (~1));
25537 obj_conv.is_owned = false;
25538 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
25539 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25540 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25541 CVec_u8Z_free(ret_var);
25545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25546 LDKu8slice ser_ref;
25547 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25548 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25549 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
25550 *ret_conv = DirectionalChannelInfo_read(ser_ref);
25551 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25552 return (uint64_t)ret_conv;
25555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25556 LDKChannelInfo this_obj_conv;
25557 this_obj_conv.inner = (void*)(this_obj & (~1));
25558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25559 ChannelInfo_free(this_obj_conv);
25562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
25563 LDKChannelInfo this_ptr_conv;
25564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25565 this_ptr_conv.is_owned = false;
25566 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
25567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25569 uint64_t ret_ref = (uint64_t)ret_var.inner;
25570 if (ret_var.is_owned) {
25576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25577 LDKChannelInfo this_ptr_conv;
25578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25579 this_ptr_conv.is_owned = false;
25580 LDKChannelFeatures val_conv;
25581 val_conv.inner = (void*)(val & (~1));
25582 val_conv.is_owned = (val & 1) || (val == 0);
25583 val_conv = ChannelFeatures_clone(&val_conv);
25584 ChannelInfo_set_features(&this_ptr_conv, val_conv);
25587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
25588 LDKChannelInfo this_ptr_conv;
25589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25590 this_ptr_conv.is_owned = false;
25591 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25592 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
25596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25597 LDKChannelInfo this_ptr_conv;
25598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25599 this_ptr_conv.is_owned = false;
25600 LDKPublicKey val_ref;
25601 CHECK((*env)->GetArrayLength(env, val) == 33);
25602 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25603 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
25606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
25607 LDKChannelInfo this_ptr_conv;
25608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25609 this_ptr_conv.is_owned = false;
25610 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
25611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25613 uint64_t ret_ref = (uint64_t)ret_var.inner;
25614 if (ret_var.is_owned) {
25620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25621 LDKChannelInfo this_ptr_conv;
25622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25623 this_ptr_conv.is_owned = false;
25624 LDKDirectionalChannelInfo val_conv;
25625 val_conv.inner = (void*)(val & (~1));
25626 val_conv.is_owned = (val & 1) || (val == 0);
25627 val_conv = DirectionalChannelInfo_clone(&val_conv);
25628 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
25631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
25632 LDKChannelInfo this_ptr_conv;
25633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25634 this_ptr_conv.is_owned = false;
25635 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
25640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25641 LDKChannelInfo this_ptr_conv;
25642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25643 this_ptr_conv.is_owned = false;
25644 LDKPublicKey val_ref;
25645 CHECK((*env)->GetArrayLength(env, val) == 33);
25646 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25647 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
25650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
25651 LDKChannelInfo this_ptr_conv;
25652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25653 this_ptr_conv.is_owned = false;
25654 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
25655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25657 uint64_t ret_ref = (uint64_t)ret_var.inner;
25658 if (ret_var.is_owned) {
25664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25665 LDKChannelInfo this_ptr_conv;
25666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25667 this_ptr_conv.is_owned = false;
25668 LDKDirectionalChannelInfo val_conv;
25669 val_conv.inner = (void*)(val & (~1));
25670 val_conv.is_owned = (val & 1) || (val == 0);
25671 val_conv = DirectionalChannelInfo_clone(&val_conv);
25672 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
25675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
25676 LDKChannelInfo this_ptr_conv;
25677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25678 this_ptr_conv.is_owned = false;
25679 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25680 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
25681 uint64_t ret_ref = (uint64_t)ret_copy;
25685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25686 LDKChannelInfo this_ptr_conv;
25687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25688 this_ptr_conv.is_owned = false;
25689 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25690 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
25693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25694 LDKChannelInfo this_ptr_conv;
25695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25696 this_ptr_conv.is_owned = false;
25697 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
25698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25700 uint64_t ret_ref = (uint64_t)ret_var.inner;
25701 if (ret_var.is_owned) {
25707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25708 LDKChannelInfo this_ptr_conv;
25709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25710 this_ptr_conv.is_owned = false;
25711 LDKChannelAnnouncement val_conv;
25712 val_conv.inner = (void*)(val & (~1));
25713 val_conv.is_owned = (val & 1) || (val == 0);
25714 val_conv = ChannelAnnouncement_clone(&val_conv);
25715 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
25718 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) {
25719 LDKChannelFeatures features_arg_conv;
25720 features_arg_conv.inner = (void*)(features_arg & (~1));
25721 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25722 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
25723 LDKPublicKey node_one_arg_ref;
25724 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
25725 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
25726 LDKDirectionalChannelInfo one_to_two_arg_conv;
25727 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
25728 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
25729 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
25730 LDKPublicKey node_two_arg_ref;
25731 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
25732 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
25733 LDKDirectionalChannelInfo two_to_one_arg_conv;
25734 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
25735 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
25736 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
25737 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
25738 LDKChannelAnnouncement announcement_message_arg_conv;
25739 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25740 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25741 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
25742 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);
25743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25745 uint64_t ret_ref = (uint64_t)ret_var.inner;
25746 if (ret_var.is_owned) {
25752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25753 LDKChannelInfo orig_conv;
25754 orig_conv.inner = (void*)(orig & (~1));
25755 orig_conv.is_owned = false;
25756 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
25757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25759 uint64_t ret_ref = (uint64_t)ret_var.inner;
25760 if (ret_var.is_owned) {
25766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
25767 LDKChannelInfo obj_conv;
25768 obj_conv.inner = (void*)(obj & (~1));
25769 obj_conv.is_owned = false;
25770 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
25771 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25772 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25773 CVec_u8Z_free(ret_var);
25777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25778 LDKu8slice ser_ref;
25779 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25780 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25781 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25782 *ret_conv = ChannelInfo_read(ser_ref);
25783 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25784 return (uint64_t)ret_conv;
25787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25788 LDKRoutingFees this_obj_conv;
25789 this_obj_conv.inner = (void*)(this_obj & (~1));
25790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25791 RoutingFees_free(this_obj_conv);
25794 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25795 LDKRoutingFees this_ptr_conv;
25796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25797 this_ptr_conv.is_owned = false;
25798 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
25802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25803 LDKRoutingFees this_ptr_conv;
25804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25805 this_ptr_conv.is_owned = false;
25806 RoutingFees_set_base_msat(&this_ptr_conv, val);
25809 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25810 LDKRoutingFees this_ptr_conv;
25811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25812 this_ptr_conv.is_owned = false;
25813 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
25817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25818 LDKRoutingFees this_ptr_conv;
25819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25820 this_ptr_conv.is_owned = false;
25821 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
25824 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) {
25825 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
25826 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25827 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25828 uint64_t ret_ref = (uint64_t)ret_var.inner;
25829 if (ret_var.is_owned) {
25835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25836 LDKRoutingFees a_conv;
25837 a_conv.inner = (void*)(a & (~1));
25838 a_conv.is_owned = false;
25839 LDKRoutingFees b_conv;
25840 b_conv.inner = (void*)(b & (~1));
25841 b_conv.is_owned = false;
25842 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
25846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25847 LDKRoutingFees orig_conv;
25848 orig_conv.inner = (void*)(orig & (~1));
25849 orig_conv.is_owned = false;
25850 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
25851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25853 uint64_t ret_ref = (uint64_t)ret_var.inner;
25854 if (ret_var.is_owned) {
25860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
25861 LDKRoutingFees obj_conv;
25862 obj_conv.inner = (void*)(obj & (~1));
25863 obj_conv.is_owned = false;
25864 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
25865 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25866 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25867 CVec_u8Z_free(ret_var);
25871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25872 LDKu8slice ser_ref;
25873 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25874 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25875 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25876 *ret_conv = RoutingFees_read(ser_ref);
25877 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25878 return (uint64_t)ret_conv;
25881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25882 LDKNodeAnnouncementInfo this_obj_conv;
25883 this_obj_conv.inner = (void*)(this_obj & (~1));
25884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25885 NodeAnnouncementInfo_free(this_obj_conv);
25888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
25889 LDKNodeAnnouncementInfo this_ptr_conv;
25890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25891 this_ptr_conv.is_owned = false;
25892 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
25893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25895 uint64_t ret_ref = (uint64_t)ret_var.inner;
25896 if (ret_var.is_owned) {
25902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25903 LDKNodeAnnouncementInfo this_ptr_conv;
25904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25905 this_ptr_conv.is_owned = false;
25906 LDKNodeFeatures val_conv;
25907 val_conv.inner = (void*)(val & (~1));
25908 val_conv.is_owned = (val & 1) || (val == 0);
25909 val_conv = NodeFeatures_clone(&val_conv);
25910 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
25913 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
25914 LDKNodeAnnouncementInfo this_ptr_conv;
25915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25916 this_ptr_conv.is_owned = false;
25917 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
25921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25922 LDKNodeAnnouncementInfo this_ptr_conv;
25923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25924 this_ptr_conv.is_owned = false;
25925 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
25928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
25929 LDKNodeAnnouncementInfo this_ptr_conv;
25930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25931 this_ptr_conv.is_owned = false;
25932 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
25933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
25937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25938 LDKNodeAnnouncementInfo this_ptr_conv;
25939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25940 this_ptr_conv.is_owned = false;
25941 LDKThreeBytes val_ref;
25942 CHECK((*env)->GetArrayLength(env, val) == 3);
25943 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
25944 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
25947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
25948 LDKNodeAnnouncementInfo this_ptr_conv;
25949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25950 this_ptr_conv.is_owned = false;
25951 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25952 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
25956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25957 LDKNodeAnnouncementInfo this_ptr_conv;
25958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25959 this_ptr_conv.is_owned = false;
25960 LDKThirtyTwoBytes val_ref;
25961 CHECK((*env)->GetArrayLength(env, val) == 32);
25962 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25963 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
25966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25967 LDKNodeAnnouncementInfo this_ptr_conv;
25968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25969 this_ptr_conv.is_owned = false;
25970 LDKCVec_NetAddressZ val_constr;
25971 val_constr.datalen = (*env)->GetArrayLength(env, val);
25972 if (val_constr.datalen > 0)
25973 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25975 val_constr.data = NULL;
25976 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25977 for (size_t m = 0; m < val_constr.datalen; m++) {
25978 int64_t val_conv_12 = val_vals[m];
25979 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
25980 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25981 val_constr.data[m] = val_conv_12_conv;
25983 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25984 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
25987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25988 LDKNodeAnnouncementInfo this_ptr_conv;
25989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25990 this_ptr_conv.is_owned = false;
25991 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
25992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25994 uint64_t ret_ref = (uint64_t)ret_var.inner;
25995 if (ret_var.is_owned) {
26001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26002 LDKNodeAnnouncementInfo this_ptr_conv;
26003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26004 this_ptr_conv.is_owned = false;
26005 LDKNodeAnnouncement val_conv;
26006 val_conv.inner = (void*)(val & (~1));
26007 val_conv.is_owned = (val & 1) || (val == 0);
26008 val_conv = NodeAnnouncement_clone(&val_conv);
26009 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
26012 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) {
26013 LDKNodeFeatures features_arg_conv;
26014 features_arg_conv.inner = (void*)(features_arg & (~1));
26015 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26016 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
26017 LDKThreeBytes rgb_arg_ref;
26018 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
26019 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
26020 LDKThirtyTwoBytes alias_arg_ref;
26021 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
26022 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
26023 LDKCVec_NetAddressZ addresses_arg_constr;
26024 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
26025 if (addresses_arg_constr.datalen > 0)
26026 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26028 addresses_arg_constr.data = NULL;
26029 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
26030 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
26031 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
26032 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
26033 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
26035 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
26036 LDKNodeAnnouncement announcement_message_arg_conv;
26037 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
26038 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
26039 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
26040 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
26041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26043 uint64_t ret_ref = (uint64_t)ret_var.inner;
26044 if (ret_var.is_owned) {
26050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26051 LDKNodeAnnouncementInfo orig_conv;
26052 orig_conv.inner = (void*)(orig & (~1));
26053 orig_conv.is_owned = false;
26054 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
26055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26057 uint64_t ret_ref = (uint64_t)ret_var.inner;
26058 if (ret_var.is_owned) {
26064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
26065 LDKNodeAnnouncementInfo obj_conv;
26066 obj_conv.inner = (void*)(obj & (~1));
26067 obj_conv.is_owned = false;
26068 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
26069 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26070 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26071 CVec_u8Z_free(ret_var);
26075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26076 LDKu8slice ser_ref;
26077 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26078 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26079 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26080 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
26081 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26082 return (uint64_t)ret_conv;
26085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26086 LDKNodeInfo this_obj_conv;
26087 this_obj_conv.inner = (void*)(this_obj & (~1));
26088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26089 NodeInfo_free(this_obj_conv);
26092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
26093 LDKNodeInfo this_ptr_conv;
26094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26095 this_ptr_conv.is_owned = false;
26096 LDKCVec_u64Z val_constr;
26097 val_constr.datalen = (*env)->GetArrayLength(env, val);
26098 if (val_constr.datalen > 0)
26099 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26101 val_constr.data = NULL;
26102 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
26103 for (size_t g = 0; g < val_constr.datalen; g++) {
26104 int64_t val_conv_6 = val_vals[g];
26105 val_constr.data[g] = val_conv_6;
26107 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
26108 NodeInfo_set_channels(&this_ptr_conv, val_constr);
26111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
26112 LDKNodeInfo this_ptr_conv;
26113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26114 this_ptr_conv.is_owned = false;
26115 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
26116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26118 uint64_t ret_ref = (uint64_t)ret_var.inner;
26119 if (ret_var.is_owned) {
26125 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) {
26126 LDKNodeInfo this_ptr_conv;
26127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26128 this_ptr_conv.is_owned = false;
26129 LDKRoutingFees val_conv;
26130 val_conv.inner = (void*)(val & (~1));
26131 val_conv.is_owned = (val & 1) || (val == 0);
26132 val_conv = RoutingFees_clone(&val_conv);
26133 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
26136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
26137 LDKNodeInfo this_ptr_conv;
26138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26139 this_ptr_conv.is_owned = false;
26140 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
26141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26143 uint64_t ret_ref = (uint64_t)ret_var.inner;
26144 if (ret_var.is_owned) {
26150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26151 LDKNodeInfo this_ptr_conv;
26152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26153 this_ptr_conv.is_owned = false;
26154 LDKNodeAnnouncementInfo val_conv;
26155 val_conv.inner = (void*)(val & (~1));
26156 val_conv.is_owned = (val & 1) || (val == 0);
26157 val_conv = NodeAnnouncementInfo_clone(&val_conv);
26158 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
26161 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) {
26162 LDKCVec_u64Z channels_arg_constr;
26163 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
26164 if (channels_arg_constr.datalen > 0)
26165 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26167 channels_arg_constr.data = NULL;
26168 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
26169 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
26170 int64_t channels_arg_conv_6 = channels_arg_vals[g];
26171 channels_arg_constr.data[g] = channels_arg_conv_6;
26173 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
26174 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
26175 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
26176 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
26177 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
26178 LDKNodeAnnouncementInfo announcement_info_arg_conv;
26179 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
26180 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
26181 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
26182 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
26183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26185 uint64_t ret_ref = (uint64_t)ret_var.inner;
26186 if (ret_var.is_owned) {
26192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26193 LDKNodeInfo orig_conv;
26194 orig_conv.inner = (void*)(orig & (~1));
26195 orig_conv.is_owned = false;
26196 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
26197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26199 uint64_t ret_ref = (uint64_t)ret_var.inner;
26200 if (ret_var.is_owned) {
26206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
26207 LDKNodeInfo obj_conv;
26208 obj_conv.inner = (void*)(obj & (~1));
26209 obj_conv.is_owned = false;
26210 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
26211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26213 CVec_u8Z_free(ret_var);
26217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26218 LDKu8slice ser_ref;
26219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26221 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26222 *ret_conv = NodeInfo_read(ser_ref);
26223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26224 return (uint64_t)ret_conv;
26227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
26228 LDKNetworkGraph obj_conv;
26229 obj_conv.inner = (void*)(obj & (~1));
26230 obj_conv.is_owned = false;
26231 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
26232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26234 CVec_u8Z_free(ret_var);
26238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26239 LDKu8slice ser_ref;
26240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26242 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26243 *ret_conv = NetworkGraph_read(ser_ref);
26244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26245 return (uint64_t)ret_conv;
26248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
26249 LDKThirtyTwoBytes genesis_hash_ref;
26250 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
26251 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
26252 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
26253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26255 uint64_t ret_ref = (uint64_t)ret_var.inner;
26256 if (ret_var.is_owned) {
26262 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) {
26263 LDKNetworkGraph this_arg_conv;
26264 this_arg_conv.inner = (void*)(this_arg & (~1));
26265 this_arg_conv.is_owned = false;
26266 LDKNodeAnnouncement msg_conv;
26267 msg_conv.inner = (void*)(msg & (~1));
26268 msg_conv.is_owned = false;
26269 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26270 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
26271 return (uint64_t)ret_conv;
26274 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) {
26275 LDKNetworkGraph this_arg_conv;
26276 this_arg_conv.inner = (void*)(this_arg & (~1));
26277 this_arg_conv.is_owned = false;
26278 LDKUnsignedNodeAnnouncement msg_conv;
26279 msg_conv.inner = (void*)(msg & (~1));
26280 msg_conv.is_owned = false;
26281 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26282 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
26283 return (uint64_t)ret_conv;
26286 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) {
26287 LDKNetworkGraph this_arg_conv;
26288 this_arg_conv.inner = (void*)(this_arg & (~1));
26289 this_arg_conv.is_owned = false;
26290 LDKChannelAnnouncement msg_conv;
26291 msg_conv.inner = (void*)(msg & (~1));
26292 msg_conv.is_owned = false;
26293 LDKAccess *chain_access_conv_ptr = NULL;
26294 if (chain_access != 0) {
26295 LDKAccess chain_access_conv;
26296 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
26297 if (chain_access_conv.free == LDKAccess_JCalls_free) {
26298 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26299 LDKAccess_JCalls_cloned(&chain_access_conv);
26301 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
26302 *chain_access_conv_ptr = chain_access_conv;
26304 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26305 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
26306 return (uint64_t)ret_conv;
26309 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) {
26310 LDKNetworkGraph this_arg_conv;
26311 this_arg_conv.inner = (void*)(this_arg & (~1));
26312 this_arg_conv.is_owned = false;
26313 LDKUnsignedChannelAnnouncement msg_conv;
26314 msg_conv.inner = (void*)(msg & (~1));
26315 msg_conv.is_owned = false;
26316 LDKAccess *chain_access_conv_ptr = NULL;
26317 if (chain_access != 0) {
26318 LDKAccess chain_access_conv;
26319 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
26320 if (chain_access_conv.free == LDKAccess_JCalls_free) {
26321 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26322 LDKAccess_JCalls_cloned(&chain_access_conv);
26324 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
26325 *chain_access_conv_ptr = chain_access_conv;
26327 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26328 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
26329 return (uint64_t)ret_conv;
26332 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) {
26333 LDKNetworkGraph this_arg_conv;
26334 this_arg_conv.inner = (void*)(this_arg & (~1));
26335 this_arg_conv.is_owned = false;
26336 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
26339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
26340 LDKNetworkGraph this_arg_conv;
26341 this_arg_conv.inner = (void*)(this_arg & (~1));
26342 this_arg_conv.is_owned = false;
26343 LDKChannelUpdate msg_conv;
26344 msg_conv.inner = (void*)(msg & (~1));
26345 msg_conv.is_owned = false;
26346 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26347 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
26348 return (uint64_t)ret_conv;
26351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
26352 LDKNetworkGraph this_arg_conv;
26353 this_arg_conv.inner = (void*)(this_arg & (~1));
26354 this_arg_conv.is_owned = false;
26355 LDKUnsignedChannelUpdate msg_conv;
26356 msg_conv.inner = (void*)(msg & (~1));
26357 msg_conv.is_owned = false;
26358 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26359 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
26360 return (uint64_t)ret_conv;
26363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26364 LDKFilesystemPersister this_obj_conv;
26365 this_obj_conv.inner = (void*)(this_obj & (~1));
26366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26367 FilesystemPersister_free(this_obj_conv);
26370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
26371 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
26372 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
26373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26375 uint64_t ret_ref = (uint64_t)ret_var.inner;
26376 if (ret_var.is_owned) {
26382 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
26383 LDKFilesystemPersister this_arg_conv;
26384 this_arg_conv.inner = (void*)(this_arg & (~1));
26385 this_arg_conv.is_owned = false;
26386 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
26387 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
26393 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
26394 LDKChannelManager manager_conv;
26395 manager_conv.inner = (void*)(manager & (~1));
26396 manager_conv.is_owned = false;
26397 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26398 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
26399 return (uint64_t)ret_conv;
26402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
26403 LDKFilesystemPersister this_arg_conv;
26404 this_arg_conv.inner = (void*)(this_arg & (~1));
26405 this_arg_conv.is_owned = false;
26406 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26407 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26408 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26409 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26411 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
26412 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
26413 return (uint64_t)ret_conv;
26416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
26417 LDKFilesystemPersister this_arg_conv;
26418 this_arg_conv.inner = (void*)(this_arg & (~1));
26419 this_arg_conv.is_owned = false;
26420 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
26421 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
26422 return (uint64_t)ret;
26425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26426 LDKBackgroundProcessor this_obj_conv;
26427 this_obj_conv.inner = (void*)(this_obj & (~1));
26428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26429 BackgroundProcessor_free(this_obj_conv);
26432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26433 if ((this_ptr & 1) != 0) return;
26434 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
26435 FREE((void*)this_ptr);
26436 ChannelManagerPersister_free(this_ptr_conv);
26439 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) {
26440 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
26441 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
26442 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26443 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
26445 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
26446 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
26447 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26448 LDKEventHandler_JCalls_cloned(&event_handler_conv);
26450 LDKChainMonitor chain_monitor_conv;
26451 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
26452 chain_monitor_conv.is_owned = false;
26453 LDKChannelManager channel_manager_conv;
26454 channel_manager_conv.inner = (void*)(channel_manager & (~1));
26455 channel_manager_conv.is_owned = false;
26456 LDKPeerManager peer_manager_conv;
26457 peer_manager_conv.inner = (void*)(peer_manager & (~1));
26458 peer_manager_conv.is_owned = false;
26459 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
26460 if (logger_conv.free == LDKLogger_JCalls_free) {
26461 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26462 LDKLogger_JCalls_cloned(&logger_conv);
26464 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
26465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26467 uint64_t ret_ref = (uint64_t)ret_var.inner;
26468 if (ret_var.is_owned) {
26474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
26475 LDKBackgroundProcessor this_arg_conv;
26476 this_arg_conv.inner = (void*)(this_arg & (~1));
26477 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26478 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26479 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26480 *ret_conv = BackgroundProcessor_join(this_arg_conv);
26481 return (uint64_t)ret_conv;
26484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
26485 LDKBackgroundProcessor this_arg_conv;
26486 this_arg_conv.inner = (void*)(this_arg & (~1));
26487 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26488 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26489 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26490 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
26491 return (uint64_t)ret_conv;
26494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
26498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26499 LDKInvoice this_obj_conv;
26500 this_obj_conv.inner = (void*)(this_obj & (~1));
26501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26502 Invoice_free(this_obj_conv);
26505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26507 a_conv.inner = (void*)(a & (~1));
26508 a_conv.is_owned = false;
26510 b_conv.inner = (void*)(b & (~1));
26511 b_conv.is_owned = false;
26512 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
26516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26517 LDKInvoice orig_conv;
26518 orig_conv.inner = (void*)(orig & (~1));
26519 orig_conv.is_owned = false;
26520 LDKInvoice ret_var = Invoice_clone(&orig_conv);
26521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26523 uint64_t ret_ref = (uint64_t)ret_var.inner;
26524 if (ret_var.is_owned) {
26530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26531 LDKSignedRawInvoice this_obj_conv;
26532 this_obj_conv.inner = (void*)(this_obj & (~1));
26533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26534 SignedRawInvoice_free(this_obj_conv);
26537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26538 LDKSignedRawInvoice a_conv;
26539 a_conv.inner = (void*)(a & (~1));
26540 a_conv.is_owned = false;
26541 LDKSignedRawInvoice b_conv;
26542 b_conv.inner = (void*)(b & (~1));
26543 b_conv.is_owned = false;
26544 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
26548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26549 LDKSignedRawInvoice orig_conv;
26550 orig_conv.inner = (void*)(orig & (~1));
26551 orig_conv.is_owned = false;
26552 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
26553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26555 uint64_t ret_ref = (uint64_t)ret_var.inner;
26556 if (ret_var.is_owned) {
26562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26563 LDKRawInvoice this_obj_conv;
26564 this_obj_conv.inner = (void*)(this_obj & (~1));
26565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26566 RawInvoice_free(this_obj_conv);
26569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
26570 LDKRawInvoice this_ptr_conv;
26571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26572 this_ptr_conv.is_owned = false;
26573 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
26574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26576 uint64_t ret_ref = (uint64_t)ret_var.inner;
26577 if (ret_var.is_owned) {
26583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26584 LDKRawInvoice this_ptr_conv;
26585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26586 this_ptr_conv.is_owned = false;
26587 LDKRawDataPart val_conv;
26588 val_conv.inner = (void*)(val & (~1));
26589 val_conv.is_owned = (val & 1) || (val == 0);
26590 val_conv = RawDataPart_clone(&val_conv);
26591 RawInvoice_set_data(&this_ptr_conv, val_conv);
26594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26595 LDKRawInvoice a_conv;
26596 a_conv.inner = (void*)(a & (~1));
26597 a_conv.is_owned = false;
26598 LDKRawInvoice b_conv;
26599 b_conv.inner = (void*)(b & (~1));
26600 b_conv.is_owned = false;
26601 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
26605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26606 LDKRawInvoice orig_conv;
26607 orig_conv.inner = (void*)(orig & (~1));
26608 orig_conv.is_owned = false;
26609 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
26610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26612 uint64_t ret_ref = (uint64_t)ret_var.inner;
26613 if (ret_var.is_owned) {
26619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26620 LDKRawDataPart this_obj_conv;
26621 this_obj_conv.inner = (void*)(this_obj & (~1));
26622 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26623 RawDataPart_free(this_obj_conv);
26626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
26627 LDKRawDataPart this_ptr_conv;
26628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26629 this_ptr_conv.is_owned = false;
26630 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
26631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26633 uint64_t ret_ref = (uint64_t)ret_var.inner;
26634 if (ret_var.is_owned) {
26640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26641 LDKRawDataPart this_ptr_conv;
26642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26643 this_ptr_conv.is_owned = false;
26644 LDKPositiveTimestamp val_conv;
26645 val_conv.inner = (void*)(val & (~1));
26646 val_conv.is_owned = (val & 1) || (val == 0);
26647 val_conv = PositiveTimestamp_clone(&val_conv);
26648 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
26651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26652 LDKRawDataPart a_conv;
26653 a_conv.inner = (void*)(a & (~1));
26654 a_conv.is_owned = false;
26655 LDKRawDataPart b_conv;
26656 b_conv.inner = (void*)(b & (~1));
26657 b_conv.is_owned = false;
26658 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
26662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26663 LDKRawDataPart orig_conv;
26664 orig_conv.inner = (void*)(orig & (~1));
26665 orig_conv.is_owned = false;
26666 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
26667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26669 uint64_t ret_ref = (uint64_t)ret_var.inner;
26670 if (ret_var.is_owned) {
26676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26677 LDKPositiveTimestamp this_obj_conv;
26678 this_obj_conv.inner = (void*)(this_obj & (~1));
26679 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26680 PositiveTimestamp_free(this_obj_conv);
26683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26684 LDKPositiveTimestamp a_conv;
26685 a_conv.inner = (void*)(a & (~1));
26686 a_conv.is_owned = false;
26687 LDKPositiveTimestamp b_conv;
26688 b_conv.inner = (void*)(b & (~1));
26689 b_conv.is_owned = false;
26690 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
26694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26695 LDKPositiveTimestamp orig_conv;
26696 orig_conv.inner = (void*)(orig & (~1));
26697 orig_conv.is_owned = false;
26698 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
26699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26701 uint64_t ret_ref = (uint64_t)ret_var.inner;
26702 if (ret_var.is_owned) {
26708 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26709 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
26710 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
26714 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
26715 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
26719 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
26720 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
26724 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
26725 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
26729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
26730 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
26734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26735 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
26736 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
26737 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
26741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
26742 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
26743 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
26747 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26748 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
26749 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
26753 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
26754 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
26758 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
26759 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
26763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
26764 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
26768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
26769 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
26773 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
26774 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
26778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26779 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
26780 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
26781 jboolean ret_val = Currency_eq(a_conv, b_conv);
26785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26786 LDKSha256 this_obj_conv;
26787 this_obj_conv.inner = (void*)(this_obj & (~1));
26788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26789 Sha256_free(this_obj_conv);
26792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26794 a_conv.inner = (void*)(a & (~1));
26795 a_conv.is_owned = false;
26797 b_conv.inner = (void*)(b & (~1));
26798 b_conv.is_owned = false;
26799 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
26803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26804 LDKSha256 orig_conv;
26805 orig_conv.inner = (void*)(orig & (~1));
26806 orig_conv.is_owned = false;
26807 LDKSha256 ret_var = Sha256_clone(&orig_conv);
26808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26810 uint64_t ret_ref = (uint64_t)ret_var.inner;
26811 if (ret_var.is_owned) {
26817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26818 LDKDescription this_obj_conv;
26819 this_obj_conv.inner = (void*)(this_obj & (~1));
26820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26821 Description_free(this_obj_conv);
26824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26825 LDKDescription a_conv;
26826 a_conv.inner = (void*)(a & (~1));
26827 a_conv.is_owned = false;
26828 LDKDescription b_conv;
26829 b_conv.inner = (void*)(b & (~1));
26830 b_conv.is_owned = false;
26831 jboolean ret_val = Description_eq(&a_conv, &b_conv);
26835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26836 LDKDescription orig_conv;
26837 orig_conv.inner = (void*)(orig & (~1));
26838 orig_conv.is_owned = false;
26839 LDKDescription ret_var = Description_clone(&orig_conv);
26840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26842 uint64_t ret_ref = (uint64_t)ret_var.inner;
26843 if (ret_var.is_owned) {
26849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26850 LDKPayeePubKey this_obj_conv;
26851 this_obj_conv.inner = (void*)(this_obj & (~1));
26852 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26853 PayeePubKey_free(this_obj_conv);
26856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26857 LDKPayeePubKey a_conv;
26858 a_conv.inner = (void*)(a & (~1));
26859 a_conv.is_owned = false;
26860 LDKPayeePubKey b_conv;
26861 b_conv.inner = (void*)(b & (~1));
26862 b_conv.is_owned = false;
26863 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
26867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26868 LDKPayeePubKey orig_conv;
26869 orig_conv.inner = (void*)(orig & (~1));
26870 orig_conv.is_owned = false;
26871 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
26872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26874 uint64_t ret_ref = (uint64_t)ret_var.inner;
26875 if (ret_var.is_owned) {
26881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26882 LDKExpiryTime this_obj_conv;
26883 this_obj_conv.inner = (void*)(this_obj & (~1));
26884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26885 ExpiryTime_free(this_obj_conv);
26888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26889 LDKExpiryTime a_conv;
26890 a_conv.inner = (void*)(a & (~1));
26891 a_conv.is_owned = false;
26892 LDKExpiryTime b_conv;
26893 b_conv.inner = (void*)(b & (~1));
26894 b_conv.is_owned = false;
26895 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
26899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26900 LDKExpiryTime orig_conv;
26901 orig_conv.inner = (void*)(orig & (~1));
26902 orig_conv.is_owned = false;
26903 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
26904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26906 uint64_t ret_ref = (uint64_t)ret_var.inner;
26907 if (ret_var.is_owned) {
26913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26914 LDKMinFinalCltvExpiry this_obj_conv;
26915 this_obj_conv.inner = (void*)(this_obj & (~1));
26916 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26917 MinFinalCltvExpiry_free(this_obj_conv);
26920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26921 LDKMinFinalCltvExpiry a_conv;
26922 a_conv.inner = (void*)(a & (~1));
26923 a_conv.is_owned = false;
26924 LDKMinFinalCltvExpiry b_conv;
26925 b_conv.inner = (void*)(b & (~1));
26926 b_conv.is_owned = false;
26927 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
26931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26932 LDKMinFinalCltvExpiry orig_conv;
26933 orig_conv.inner = (void*)(orig & (~1));
26934 orig_conv.is_owned = false;
26935 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
26936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26938 uint64_t ret_ref = (uint64_t)ret_var.inner;
26939 if (ret_var.is_owned) {
26945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26946 if ((this_ptr & 1) != 0) return;
26947 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
26948 FREE((void*)this_ptr);
26949 Fallback_free(this_ptr_conv);
26952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26953 LDKFallback* orig_conv = (LDKFallback*)orig;
26954 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26955 *ret_copy = Fallback_clone(orig_conv);
26956 uint64_t ret_ref = (uint64_t)ret_copy;
26960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
26962 LDKCVec_u8Z program_ref;
26963 program_ref.datalen = (*env)->GetArrayLength(env, program);
26964 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
26965 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
26966 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26967 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
26968 uint64_t ret_ref = (uint64_t)ret_copy;
26972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
26973 LDKTwentyBytes a_ref;
26974 CHECK((*env)->GetArrayLength(env, a) == 20);
26975 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
26976 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26977 *ret_copy = Fallback_pub_key_hash(a_ref);
26978 uint64_t ret_ref = (uint64_t)ret_copy;
26982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
26983 LDKTwentyBytes a_ref;
26984 CHECK((*env)->GetArrayLength(env, a) == 20);
26985 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
26986 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26987 *ret_copy = Fallback_script_hash(a_ref);
26988 uint64_t ret_ref = (uint64_t)ret_copy;
26992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26993 LDKFallback* a_conv = (LDKFallback*)a;
26994 LDKFallback* b_conv = (LDKFallback*)b;
26995 jboolean ret_val = Fallback_eq(a_conv, b_conv);
26999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27000 LDKInvoiceSignature this_obj_conv;
27001 this_obj_conv.inner = (void*)(this_obj & (~1));
27002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27003 InvoiceSignature_free(this_obj_conv);
27006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27007 LDKInvoiceSignature a_conv;
27008 a_conv.inner = (void*)(a & (~1));
27009 a_conv.is_owned = false;
27010 LDKInvoiceSignature b_conv;
27011 b_conv.inner = (void*)(b & (~1));
27012 b_conv.is_owned = false;
27013 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
27017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27018 LDKInvoiceSignature orig_conv;
27019 orig_conv.inner = (void*)(orig & (~1));
27020 orig_conv.is_owned = false;
27021 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
27022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27024 uint64_t ret_ref = (uint64_t)ret_var.inner;
27025 if (ret_var.is_owned) {
27031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27032 LDKPrivateRoute this_obj_conv;
27033 this_obj_conv.inner = (void*)(this_obj & (~1));
27034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27035 PrivateRoute_free(this_obj_conv);
27038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27039 LDKPrivateRoute a_conv;
27040 a_conv.inner = (void*)(a & (~1));
27041 a_conv.is_owned = false;
27042 LDKPrivateRoute b_conv;
27043 b_conv.inner = (void*)(b & (~1));
27044 b_conv.is_owned = false;
27045 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
27049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27050 LDKPrivateRoute orig_conv;
27051 orig_conv.inner = (void*)(orig & (~1));
27052 orig_conv.is_owned = false;
27053 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
27054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27056 uint64_t ret_ref = (uint64_t)ret_var.inner;
27057 if (ret_var.is_owned) {
27063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
27064 LDKSignedRawInvoice this_arg_conv;
27065 this_arg_conv.inner = (void*)(this_arg & (~1));
27066 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27067 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
27068 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
27069 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
27070 return (uint64_t)ret_ref;
27073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
27074 LDKSignedRawInvoice this_arg_conv;
27075 this_arg_conv.inner = (void*)(this_arg & (~1));
27076 this_arg_conv.is_owned = false;
27077 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
27078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27080 uint64_t ret_ref = (uint64_t)ret_var.inner;
27081 if (ret_var.is_owned) {
27087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27088 LDKSignedRawInvoice this_arg_conv;
27089 this_arg_conv.inner = (void*)(this_arg & (~1));
27090 this_arg_conv.is_owned = false;
27091 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27092 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
27096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27097 LDKSignedRawInvoice this_arg_conv;
27098 this_arg_conv.inner = (void*)(this_arg & (~1));
27099 this_arg_conv.is_owned = false;
27100 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
27101 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27102 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27103 uint64_t ret_ref = (uint64_t)ret_var.inner;
27104 if (ret_var.is_owned) {
27110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27111 LDKSignedRawInvoice this_arg_conv;
27112 this_arg_conv.inner = (void*)(this_arg & (~1));
27113 this_arg_conv.is_owned = false;
27114 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27115 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
27116 return (uint64_t)ret_conv;
27119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27120 LDKSignedRawInvoice this_arg_conv;
27121 this_arg_conv.inner = (void*)(this_arg & (~1));
27122 this_arg_conv.is_owned = false;
27123 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
27127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27128 LDKRawInvoice this_arg_conv;
27129 this_arg_conv.inner = (void*)(this_arg & (~1));
27130 this_arg_conv.is_owned = false;
27131 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27132 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
27136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27137 LDKRawInvoice this_arg_conv;
27138 this_arg_conv.inner = (void*)(this_arg & (~1));
27139 this_arg_conv.is_owned = false;
27140 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
27141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27143 uint64_t ret_ref = (uint64_t)ret_var.inner;
27144 if (ret_var.is_owned) {
27150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
27151 LDKRawInvoice this_arg_conv;
27152 this_arg_conv.inner = (void*)(this_arg & (~1));
27153 this_arg_conv.is_owned = false;
27154 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
27155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27157 uint64_t ret_ref = (uint64_t)ret_var.inner;
27158 if (ret_var.is_owned) {
27164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27165 LDKRawInvoice this_arg_conv;
27166 this_arg_conv.inner = (void*)(this_arg & (~1));
27167 this_arg_conv.is_owned = false;
27168 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
27169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27171 uint64_t ret_ref = (uint64_t)ret_var.inner;
27172 if (ret_var.is_owned) {
27178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27179 LDKRawInvoice this_arg_conv;
27180 this_arg_conv.inner = (void*)(this_arg & (~1));
27181 this_arg_conv.is_owned = false;
27182 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
27183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27185 uint64_t ret_ref = (uint64_t)ret_var.inner;
27186 if (ret_var.is_owned) {
27192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27193 LDKRawInvoice this_arg_conv;
27194 this_arg_conv.inner = (void*)(this_arg & (~1));
27195 this_arg_conv.is_owned = false;
27196 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
27197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27199 uint64_t ret_ref = (uint64_t)ret_var.inner;
27200 if (ret_var.is_owned) {
27206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
27207 LDKRawInvoice this_arg_conv;
27208 this_arg_conv.inner = (void*)(this_arg & (~1));
27209 this_arg_conv.is_owned = false;
27210 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
27211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27213 uint64_t ret_ref = (uint64_t)ret_var.inner;
27214 if (ret_var.is_owned) {
27220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27221 LDKRawInvoice this_arg_conv;
27222 this_arg_conv.inner = (void*)(this_arg & (~1));
27223 this_arg_conv.is_owned = false;
27224 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27225 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
27229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
27230 LDKRawInvoice this_arg_conv;
27231 this_arg_conv.inner = (void*)(this_arg & (~1));
27232 this_arg_conv.is_owned = false;
27233 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
27234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27236 uint64_t ret_ref = (uint64_t)ret_var.inner;
27237 if (ret_var.is_owned) {
27243 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
27244 LDKRawInvoice this_arg_conv;
27245 this_arg_conv.inner = (void*)(this_arg & (~1));
27246 this_arg_conv.is_owned = false;
27247 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
27248 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27249 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27250 for (size_t o = 0; o < ret_var.datalen; o++) {
27251 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27252 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27253 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27254 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27255 if (ret_conv_14_var.is_owned) {
27256 ret_conv_14_ref |= 1;
27258 ret_arr_ptr[o] = ret_conv_14_ref;
27260 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27261 FREE(ret_var.data);
27265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
27266 LDKRawInvoice this_arg_conv;
27267 this_arg_conv.inner = (void*)(this_arg & (~1));
27268 this_arg_conv.is_owned = false;
27269 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27270 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
27271 uint64_t ret_ref = (uint64_t)ret_copy;
27275 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
27276 LDKRawInvoice this_arg_conv;
27277 this_arg_conv.inner = (void*)(this_arg & (~1));
27278 this_arg_conv.is_owned = false;
27279 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
27283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
27284 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27285 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
27286 return (uint64_t)ret_conv;
27289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
27290 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27291 *ret_conv = PositiveTimestamp_from_system_time(time);
27292 return (uint64_t)ret_conv;
27295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
27296 LDKPositiveTimestamp this_arg_conv;
27297 this_arg_conv.inner = (void*)(this_arg & (~1));
27298 this_arg_conv.is_owned = false;
27299 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
27303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27304 LDKPositiveTimestamp this_arg_conv;
27305 this_arg_conv.inner = (void*)(this_arg & (~1));
27306 this_arg_conv.is_owned = false;
27307 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
27311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
27312 LDKInvoice this_arg_conv;
27313 this_arg_conv.inner = (void*)(this_arg & (~1));
27314 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27315 this_arg_conv = Invoice_clone(&this_arg_conv);
27316 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
27317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27319 uint64_t ret_ref = (uint64_t)ret_var.inner;
27320 if (ret_var.is_owned) {
27326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27327 LDKInvoice this_arg_conv;
27328 this_arg_conv.inner = (void*)(this_arg & (~1));
27329 this_arg_conv.is_owned = false;
27330 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
27331 *ret_conv = Invoice_check_signature(&this_arg_conv);
27332 return (uint64_t)ret_conv;
27335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
27336 LDKSignedRawInvoice signed_invoice_conv;
27337 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
27338 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
27339 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
27340 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
27341 *ret_conv = Invoice_from_signed(signed_invoice_conv);
27342 return (uint64_t)ret_conv;
27345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
27346 LDKInvoice this_arg_conv;
27347 this_arg_conv.inner = (void*)(this_arg & (~1));
27348 this_arg_conv.is_owned = false;
27349 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
27353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27354 LDKInvoice this_arg_conv;
27355 this_arg_conv.inner = (void*)(this_arg & (~1));
27356 this_arg_conv.is_owned = false;
27357 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27358 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
27362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27363 LDKInvoice this_arg_conv;
27364 this_arg_conv.inner = (void*)(this_arg & (~1));
27365 this_arg_conv.is_owned = false;
27366 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27367 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
27371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27372 LDKInvoice this_arg_conv;
27373 this_arg_conv.inner = (void*)(this_arg & (~1));
27374 this_arg_conv.is_owned = false;
27375 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
27380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
27381 LDKInvoice this_arg_conv;
27382 this_arg_conv.inner = (void*)(this_arg & (~1));
27383 this_arg_conv.is_owned = false;
27384 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
27385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27387 uint64_t ret_ref = (uint64_t)ret_var.inner;
27388 if (ret_var.is_owned) {
27394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27395 LDKInvoice this_arg_conv;
27396 this_arg_conv.inner = (void*)(this_arg & (~1));
27397 this_arg_conv.is_owned = false;
27398 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27399 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
27403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27404 LDKInvoice this_arg_conv;
27405 this_arg_conv.inner = (void*)(this_arg & (~1));
27406 this_arg_conv.is_owned = false;
27407 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
27411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
27412 LDKInvoice this_arg_conv;
27413 this_arg_conv.inner = (void*)(this_arg & (~1));
27414 this_arg_conv.is_owned = false;
27415 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
27419 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
27420 LDKInvoice this_arg_conv;
27421 this_arg_conv.inner = (void*)(this_arg & (~1));
27422 this_arg_conv.is_owned = false;
27423 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
27424 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27425 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27426 for (size_t o = 0; o < ret_var.datalen; o++) {
27427 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27428 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27429 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27430 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27431 if (ret_conv_14_var.is_owned) {
27432 ret_conv_14_ref |= 1;
27434 ret_arr_ptr[o] = ret_conv_14_ref;
27436 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27437 FREE(ret_var.data);
27441 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
27442 LDKInvoice this_arg_conv;
27443 this_arg_conv.inner = (void*)(this_arg & (~1));
27444 this_arg_conv.is_owned = false;
27445 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
27446 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27447 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27448 for (size_t l = 0; l < ret_var.datalen; l++) {
27449 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27450 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27451 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27452 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27453 if (ret_conv_11_var.is_owned) {
27454 ret_conv_11_ref |= 1;
27456 ret_arr_ptr[l] = ret_conv_11_ref;
27458 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27459 FREE(ret_var.data);
27463 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
27464 LDKInvoice this_arg_conv;
27465 this_arg_conv.inner = (void*)(this_arg & (~1));
27466 this_arg_conv.is_owned = false;
27467 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
27471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
27472 LDKInvoice this_arg_conv;
27473 this_arg_conv.inner = (void*)(this_arg & (~1));
27474 this_arg_conv.is_owned = false;
27475 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27476 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
27477 uint64_t ret_ref = (uint64_t)ret_copy;
27481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
27482 LDKStr description_conv = java_to_owned_str(env, description);
27483 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27484 *ret_conv = Description_new(description_conv);
27485 return (uint64_t)ret_conv;
27488 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27489 LDKDescription this_arg_conv;
27490 this_arg_conv.inner = (void*)(this_arg & (~1));
27491 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27492 this_arg_conv = Description_clone(&this_arg_conv);
27493 LDKStr ret_str = Description_into_inner(this_arg_conv);
27494 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
27500 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27501 *ret_conv = ExpiryTime_from_seconds(seconds);
27502 return (uint64_t)ret_conv;
27505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
27506 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27507 *ret_conv = ExpiryTime_from_duration(duration);
27508 return (uint64_t)ret_conv;
27511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
27512 LDKExpiryTime this_arg_conv;
27513 this_arg_conv.inner = (void*)(this_arg & (~1));
27514 this_arg_conv.is_owned = false;
27515 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
27519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
27520 LDKExpiryTime this_arg_conv;
27521 this_arg_conv.inner = (void*)(this_arg & (~1));
27522 this_arg_conv.is_owned = false;
27523 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
27527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
27528 LDKRouteHint hops_conv;
27529 hops_conv.inner = (void*)(hops & (~1));
27530 hops_conv.is_owned = (hops & 1) || (hops == 0);
27531 hops_conv = RouteHint_clone(&hops_conv);
27532 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27533 *ret_conv = PrivateRoute_new(hops_conv);
27534 return (uint64_t)ret_conv;
27537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27538 LDKPrivateRoute this_arg_conv;
27539 this_arg_conv.inner = (void*)(this_arg & (~1));
27540 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27541 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
27542 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
27543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27545 uint64_t ret_ref = (uint64_t)ret_var.inner;
27546 if (ret_var.is_owned) {
27552 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27553 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
27554 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
27558 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
27559 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
27563 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
27564 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
27568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
27569 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
27573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
27574 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
27578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27579 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
27580 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
27581 jboolean ret_val = CreationError_eq(a_conv, b_conv);
27585 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27586 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
27587 LDKStr ret_str = CreationError_to_str(o_conv);
27588 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27594 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
27595 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
27599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
27600 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
27604 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
27605 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
27609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
27610 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
27614 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
27615 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
27619 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
27620 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
27624 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
27625 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
27629 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
27630 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
27634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
27635 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
27639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27640 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
27641 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
27642 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
27646 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27647 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
27648 LDKStr ret_str = SemanticError_to_str(o_conv);
27649 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27655 if ((this_ptr & 1) != 0) return;
27656 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
27657 FREE((void*)this_ptr);
27658 SignOrCreationError_free(this_ptr_conv);
27661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27662 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
27663 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27664 *ret_copy = SignOrCreationError_clone(orig_conv);
27665 uint64_t ret_ref = (uint64_t)ret_copy;
27669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
27670 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27671 *ret_copy = SignOrCreationError_sign_error();
27672 uint64_t ret_ref = (uint64_t)ret_copy;
27676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
27677 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
27678 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27679 *ret_copy = SignOrCreationError_creation_error(a_conv);
27680 uint64_t ret_ref = (uint64_t)ret_copy;
27684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27685 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
27686 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
27687 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
27691 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27692 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
27693 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
27694 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27699 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) {
27700 LDKChannelManager channelmanager_conv;
27701 channelmanager_conv.inner = (void*)(channelmanager & (~1));
27702 channelmanager_conv.is_owned = false;
27703 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
27704 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27705 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27706 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27708 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
27709 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
27710 LDKStr description_conv = java_to_owned_str(env, description);
27711 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
27712 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
27713 return (uint64_t)ret_conv;
27716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27717 LDKStr s_conv = java_to_owned_str(env, s);
27718 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
27719 *ret_conv = SiPrefix_from_str(s_conv);
27720 return (uint64_t)ret_conv;
27723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27724 LDKStr s_conv = java_to_owned_str(env, s);
27725 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
27726 *ret_conv = Invoice_from_str(s_conv);
27727 return (uint64_t)ret_conv;
27730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27731 LDKStr s_conv = java_to_owned_str(env, s);
27732 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
27733 *ret_conv = SignedRawInvoice_from_str(s_conv);
27734 return (uint64_t)ret_conv;
27737 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27739 o_conv.inner = (void*)(o & (~1));
27740 o_conv.is_owned = false;
27741 LDKStr ret_str = Invoice_to_str(&o_conv);
27742 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27747 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27748 LDKSignedRawInvoice o_conv;
27749 o_conv.inner = (void*)(o & (~1));
27750 o_conv.is_owned = false;
27751 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
27752 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27757 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27758 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
27759 LDKStr ret_str = Currency_to_str(o_conv);
27760 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27765 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27766 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
27767 LDKStr ret_str = SiPrefix_to_str(o_conv);
27768 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);