2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
11 #define MALLOC(a, _) malloc(a)
12 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
13 #define DO_ASSERT(a) (void)(a)
16 static jmethodID ordinal_meth = NULL;
17 static jmethodID slicedef_meth = NULL;
18 static jclass slicedef_cls = NULL;
19 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
20 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
21 CHECK(ordinal_meth != NULL);
22 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
23 CHECK(slicedef_meth != NULL);
24 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
25 CHECK(slicedef_cls != NULL);
28 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
37 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
38 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
39 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
43 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
44 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
45 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
48 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
49 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
50 vec->datalen = (*env)->GetArrayLength(env, bytes);
51 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
52 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
55 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
56 LDKTransaction *txdata = (LDKTransaction*)ptr;
58 slice.data = txdata->data;
59 slice.datalen = txdata->datalen;
60 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
62 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
63 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
64 txdata->datalen = (*env)->GetArrayLength(env, bytes);
65 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
66 txdata->data_is_owned = false;
67 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
68 return (uint64_t)txdata;
70 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
71 LDKTransaction *tx = (LDKTransaction*)ptr;
72 tx->data_is_owned = true;
73 Transaction_free(*tx);
76 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
77 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
82 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
83 return (uint64_t)vec->datalen;
85 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
86 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
91 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
97 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
98 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
100 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
103 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
104 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
106 typedef jlongArray int64_tArray;
107 typedef jbyteArray int8_tArray;
109 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
110 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
111 char* conv_buf = MALLOC(len + 1, "str conv buf");
112 memcpy(conv_buf, chars, len);
114 jstring ret = (*env)->NewStringUTF(env, conv_buf);
118 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
119 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
120 char* newchars = MALLOC(str_len + 1, "String chars");
121 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
122 memcpy(newchars, jchars, str_len);
123 newchars[str_len] = 0;
124 (*env)->ReleaseStringUTFChars(env, str, jchars);
128 .chars_is_owned = true
133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, "v0.0.98.2", strlen("v0.0.98.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_Off;
456 case 1: return LDKLevel_Error;
457 case 2: return LDKLevel_Warn;
458 case 3: return LDKLevel_Info;
459 case 4: return LDKLevel_Debug;
460 case 5: return LDKLevel_Trace;
464 static jclass Level_class = NULL;
465 static jfieldID Level_LDKLevel_Off = NULL;
466 static jfieldID Level_LDKLevel_Error = NULL;
467 static jfieldID Level_LDKLevel_Warn = NULL;
468 static jfieldID Level_LDKLevel_Info = NULL;
469 static jfieldID Level_LDKLevel_Debug = NULL;
470 static jfieldID Level_LDKLevel_Trace = NULL;
471 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
472 Level_class = (*env)->NewGlobalRef(env, clz);
473 CHECK(Level_class != NULL);
474 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Off != NULL);
476 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Error != NULL);
478 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Warn != NULL);
480 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Info != NULL);
482 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
483 CHECK(Level_LDKLevel_Debug != NULL);
484 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
485 CHECK(Level_LDKLevel_Trace != NULL);
487 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
496 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
498 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
500 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
505 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
506 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
507 case 0: return LDKNetwork_Bitcoin;
508 case 1: return LDKNetwork_Testnet;
509 case 2: return LDKNetwork_Regtest;
510 case 3: return LDKNetwork_Signet;
514 static jclass Network_class = NULL;
515 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
516 static jfieldID Network_LDKNetwork_Testnet = NULL;
517 static jfieldID Network_LDKNetwork_Regtest = NULL;
518 static jfieldID Network_LDKNetwork_Signet = NULL;
519 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
520 Network_class = (*env)->NewGlobalRef(env, clz);
521 CHECK(Network_class != NULL);
522 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
523 CHECK(Network_LDKNetwork_Bitcoin != NULL);
524 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
525 CHECK(Network_LDKNetwork_Testnet != NULL);
526 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
527 CHECK(Network_LDKNetwork_Regtest != NULL);
528 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
529 CHECK(Network_LDKNetwork_Signet != NULL);
531 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
533 case LDKNetwork_Bitcoin:
534 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
535 case LDKNetwork_Testnet:
536 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
537 case LDKNetwork_Regtest:
538 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
539 case LDKNetwork_Signet:
540 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
545 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
546 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
547 case 0: return LDKSecp256k1Error_IncorrectSignature;
548 case 1: return LDKSecp256k1Error_InvalidMessage;
549 case 2: return LDKSecp256k1Error_InvalidPublicKey;
550 case 3: return LDKSecp256k1Error_InvalidSignature;
551 case 4: return LDKSecp256k1Error_InvalidSecretKey;
552 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
553 case 6: return LDKSecp256k1Error_InvalidTweak;
554 case 7: return LDKSecp256k1Error_TweakCheckFailed;
555 case 8: return LDKSecp256k1Error_NotEnoughMemory;
559 static jclass Secp256k1Error_class = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
566 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
567 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
568 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
569 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
570 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
571 CHECK(Secp256k1Error_class != NULL);
572 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
580 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
582 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
584 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
585 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
586 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
587 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
588 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
589 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
591 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
593 case LDKSecp256k1Error_IncorrectSignature:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
595 case LDKSecp256k1Error_InvalidMessage:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
597 case LDKSecp256k1Error_InvalidPublicKey:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
599 case LDKSecp256k1Error_InvalidSignature:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
601 case LDKSecp256k1Error_InvalidSecretKey:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
603 case LDKSecp256k1Error_InvalidRecoveryId:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
605 case LDKSecp256k1Error_InvalidTweak:
606 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
607 case LDKSecp256k1Error_TweakCheckFailed:
608 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
609 case LDKSecp256k1Error_NotEnoughMemory:
610 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
615 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
616 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
617 case 0: return LDKSemanticError_NoPaymentHash;
618 case 1: return LDKSemanticError_MultiplePaymentHashes;
619 case 2: return LDKSemanticError_NoDescription;
620 case 3: return LDKSemanticError_MultipleDescriptions;
621 case 4: return LDKSemanticError_MultiplePaymentSecrets;
622 case 5: return LDKSemanticError_InvalidFeatures;
623 case 6: return LDKSemanticError_InvalidRecoveryId;
624 case 7: return LDKSemanticError_InvalidSignature;
628 static jclass SemanticError_class = NULL;
629 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
630 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
631 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
633 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
634 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
635 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
636 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
637 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
638 SemanticError_class = (*env)->NewGlobalRef(env, clz);
639 CHECK(SemanticError_class != NULL);
640 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
642 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
644 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
646 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
648 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
650 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
652 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
654 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
657 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
659 case LDKSemanticError_NoPaymentHash:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
661 case LDKSemanticError_MultiplePaymentHashes:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
663 case LDKSemanticError_NoDescription:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
665 case LDKSemanticError_MultipleDescriptions:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
667 case LDKSemanticError_MultiplePaymentSecrets:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
669 case LDKSemanticError_InvalidFeatures:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
671 case LDKSemanticError_InvalidRecoveryId:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
673 case LDKSemanticError_InvalidSignature:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
679 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
680 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
681 case 0: return LDKSiPrefix_Milli;
682 case 1: return LDKSiPrefix_Micro;
683 case 2: return LDKSiPrefix_Nano;
684 case 3: return LDKSiPrefix_Pico;
688 static jclass SiPrefix_class = NULL;
689 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
690 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
691 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
692 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
693 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
694 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
695 CHECK(SiPrefix_class != NULL);
696 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
697 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
698 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
699 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
700 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
702 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
705 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
707 case LDKSiPrefix_Milli:
708 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
709 case LDKSiPrefix_Micro:
710 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
711 case LDKSiPrefix_Nano:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
713 case LDKSiPrefix_Pico:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
720 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
721 ret->datalen = (*env)->GetArrayLength(env, elems);
722 if (ret->datalen == 0) {
725 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
726 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
727 for (size_t i = 0; i < ret->datalen; i++) {
728 ret->data[i] = java_elems[i];
730 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
732 return (uint64_t)ret;
734 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
735 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
736 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
740 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
743 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
744 CHECK(val->result_ok);
745 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
746 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
750 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
751 CHECK(!val->result_ok);
752 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
756 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
759 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
760 CHECK(val->result_ok);
761 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
762 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
766 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
767 CHECK(!val->result_ok);
768 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
772 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
775 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
776 CHECK(val->result_ok);
777 LDKTxCreationKeys res_var = (*val->contents.result);
778 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
780 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
784 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
785 CHECK(!val->result_ok);
786 LDKDecodeError err_var = (*val->contents.err);
787 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
793 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
796 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
797 CHECK(val->result_ok);
798 LDKChannelPublicKeys res_var = (*val->contents.result);
799 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
800 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
801 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
805 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
806 CHECK(!val->result_ok);
807 LDKDecodeError err_var = (*val->contents.err);
808 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
809 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
810 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
814 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
817 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
818 CHECK(val->result_ok);
819 LDKTxCreationKeys res_var = (*val->contents.result);
820 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
821 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
822 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
825 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
826 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
827 CHECK(!val->result_ok);
828 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
831 static jclass LDKCOption_u32Z_Some_class = NULL;
832 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
833 static jclass LDKCOption_u32Z_None_class = NULL;
834 static jmethodID LDKCOption_u32Z_None_meth = NULL;
835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
836 LDKCOption_u32Z_Some_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
838 CHECK(LDKCOption_u32Z_Some_class != NULL);
839 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
840 CHECK(LDKCOption_u32Z_Some_meth != NULL);
841 LDKCOption_u32Z_None_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
843 CHECK(LDKCOption_u32Z_None_class != NULL);
844 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
845 CHECK(LDKCOption_u32Z_None_meth != NULL);
847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
848 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
850 case LDKCOption_u32Z_Some: {
851 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
853 case LDKCOption_u32Z_None: {
854 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
860 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
863 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
864 CHECK(val->result_ok);
865 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
866 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
867 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
868 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
872 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
873 CHECK(!val->result_ok);
874 LDKDecodeError err_var = (*val->contents.err);
875 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
876 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
877 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
881 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
884 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
885 CHECK(val->result_ok);
886 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
887 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
888 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
889 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
893 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
894 CHECK(!val->result_ok);
895 LDKDecodeError err_var = (*val->contents.err);
896 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
897 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
898 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
902 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
905 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
906 CHECK(val->result_ok);
907 LDKChannelTransactionParameters res_var = (*val->contents.result);
908 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
909 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
910 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
914 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
915 CHECK(!val->result_ok);
916 LDKDecodeError err_var = (*val->contents.err);
917 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
918 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
919 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
923 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
926 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
927 CHECK(val->result_ok);
928 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
929 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
930 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
931 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
935 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
936 CHECK(!val->result_ok);
937 LDKDecodeError err_var = (*val->contents.err);
938 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
944 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
947 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
948 CHECK(val->result_ok);
949 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
950 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
951 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
952 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
956 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
957 CHECK(!val->result_ok);
958 LDKDecodeError err_var = (*val->contents.err);
959 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
965 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
968 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
969 CHECK(val->result_ok);
970 LDKCommitmentTransaction res_var = (*val->contents.result);
971 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
972 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
973 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
977 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
978 CHECK(!val->result_ok);
979 LDKDecodeError err_var = (*val->contents.err);
980 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
986 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
989 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
990 CHECK(val->result_ok);
991 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
992 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
993 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
994 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
998 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
999 CHECK(!val->result_ok);
1000 return *val->contents.err;
1002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1003 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1005 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1006 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1007 CHECK(val->result_ok);
1008 LDKCVec_SignatureZ res_var = (*val->contents.result);
1009 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1011 for (size_t i = 0; i < res_var.datalen; i++) {
1012 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1013 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1014 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1019 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1020 CHECK(!val->result_ok);
1021 return *val->contents.err;
1023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1024 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1027 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1028 CHECK(val->result_ok);
1029 return *val->contents.result;
1031 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1032 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1033 CHECK(!val->result_ok);
1034 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1038 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1041 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1042 CHECK(val->result_ok);
1043 LDKRouteHop res_var = (*val->contents.result);
1044 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1045 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1046 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1050 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1051 CHECK(!val->result_ok);
1052 LDKDecodeError err_var = (*val->contents.err);
1053 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1054 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1055 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1059 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1060 ret->datalen = (*env)->GetArrayLength(env, elems);
1061 if (ret->datalen == 0) {
1064 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1065 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1066 for (size_t i = 0; i < ret->datalen; i++) {
1067 int64_t arr_elem = java_elems[i];
1068 LDKRouteHop arr_elem_conv;
1069 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1070 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1071 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1072 ret->data[i] = arr_elem_conv;
1074 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1076 return (uint64_t)ret;
1078 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1079 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1080 for (size_t i = 0; i < ret.datalen; i++) {
1081 ret.data[i] = RouteHop_clone(&orig->data[i]);
1085 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1086 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1087 for (size_t i = 0; i < ret.datalen; i++) {
1088 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1093 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1096 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1097 CHECK(val->result_ok);
1098 LDKRoute res_var = (*val->contents.result);
1099 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1100 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1101 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1105 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1106 CHECK(!val->result_ok);
1107 LDKDecodeError err_var = (*val->contents.err);
1108 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1113 static jclass LDKCOption_u64Z_Some_class = NULL;
1114 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1115 static jclass LDKCOption_u64Z_None_class = NULL;
1116 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1118 LDKCOption_u64Z_Some_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1120 CHECK(LDKCOption_u64Z_Some_class != NULL);
1121 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1122 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1123 LDKCOption_u64Z_None_class =
1124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1125 CHECK(LDKCOption_u64Z_None_class != NULL);
1126 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1127 CHECK(LDKCOption_u64Z_None_meth != NULL);
1129 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1130 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1132 case LDKCOption_u64Z_Some: {
1133 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1135 case LDKCOption_u64Z_None: {
1136 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1142 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1143 ret->datalen = (*env)->GetArrayLength(env, elems);
1144 if (ret->datalen == 0) {
1147 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1148 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1149 for (size_t i = 0; i < ret->datalen; i++) {
1150 int64_t arr_elem = java_elems[i];
1151 LDKChannelDetails arr_elem_conv;
1152 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1153 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1154 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1155 ret->data[i] = arr_elem_conv;
1157 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1159 return (uint64_t)ret;
1161 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1162 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1163 for (size_t i = 0; i < ret.datalen; i++) {
1164 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1169 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1170 ret->datalen = (*env)->GetArrayLength(env, elems);
1171 if (ret->datalen == 0) {
1174 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1175 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1176 for (size_t i = 0; i < ret->datalen; i++) {
1177 int64_t arr_elem = java_elems[i];
1178 LDKRouteHint arr_elem_conv;
1179 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1180 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1181 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1182 ret->data[i] = arr_elem_conv;
1184 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1186 return (uint64_t)ret;
1188 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1189 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1190 for (size_t i = 0; i < ret.datalen; i++) {
1191 ret.data[i] = RouteHint_clone(&orig->data[i]);
1195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1196 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1199 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1200 CHECK(val->result_ok);
1201 LDKRoute res_var = (*val->contents.result);
1202 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1203 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1204 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1208 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1209 CHECK(!val->result_ok);
1210 LDKLightningError err_var = (*val->contents.err);
1211 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1212 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1217 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1220 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1221 CHECK(val->result_ok);
1222 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1223 return (uint64_t)res_ref;
1225 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1226 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1227 CHECK(!val->result_ok);
1228 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1232 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1234 LDKTransaction b_ref;
1235 b_ref.datalen = (*env)->GetArrayLength(env, b);
1236 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1237 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1238 b_ref.data_is_owned = false;
1240 return (uint64_t)ret;
1242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1243 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1247 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1248 LDKTransaction b_var = tuple->b;
1249 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1250 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1254 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1255 ret->datalen = (*env)->GetArrayLength(env, elems);
1256 if (ret->datalen == 0) {
1259 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1260 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1261 for (size_t i = 0; i < ret->datalen; i++) {
1262 int64_t arr_elem = java_elems[i];
1263 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1264 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1265 ret->data[i] = arr_elem_conv;
1267 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1269 return (uint64_t)ret;
1271 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1272 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1273 for (size_t i = 0; i < ret.datalen; i++) {
1274 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1278 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1279 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1280 for (size_t i = 0; i < ret.datalen; i++) {
1281 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1286 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1289 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1290 CHECK(val->result_ok);
1291 return *val->contents.result;
1293 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1294 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1295 CHECK(!val->result_ok);
1296 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1299 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1300 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1301 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1302 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1304 LDKMonitorEvent_HTLCEvent_class =
1305 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1306 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1307 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1308 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1309 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1310 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1311 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1312 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1313 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1315 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1316 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1318 case LDKMonitorEvent_HTLCEvent: {
1319 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1320 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1321 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1322 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1323 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1325 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1326 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1327 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1328 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1329 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1330 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1336 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1337 ret->datalen = (*env)->GetArrayLength(env, elems);
1338 if (ret->datalen == 0) {
1341 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1342 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1343 for (size_t i = 0; i < ret->datalen; i++) {
1344 int64_t arr_elem = java_elems[i];
1345 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1346 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1347 ret->data[i] = arr_elem_conv;
1349 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1351 return (uint64_t)ret;
1353 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1354 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1355 for (size_t i = 0; i < ret.datalen; i++) {
1356 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1360 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1361 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1362 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1363 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1365 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1366 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1367 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1368 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1369 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1370 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1371 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1372 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1373 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1374 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1377 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1379 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1380 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1381 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1383 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1384 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1389 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1390 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1391 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1392 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1393 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1394 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1396 LDKSpendableOutputDescriptor_StaticOutput_class =
1397 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1398 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1399 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1400 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1401 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1402 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1403 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1404 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1405 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1406 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1407 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1408 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1409 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1410 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1413 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1415 case LDKSpendableOutputDescriptor_StaticOutput: {
1416 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1417 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1420 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1421 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1423 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1424 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1425 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1426 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1427 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1428 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1430 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1431 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1432 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1433 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1434 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1435 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1441 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1442 ret->datalen = (*env)->GetArrayLength(env, elems);
1443 if (ret->datalen == 0) {
1446 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1447 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1448 for (size_t i = 0; i < ret->datalen; i++) {
1449 int64_t arr_elem = java_elems[i];
1450 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1451 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1452 ret->data[i] = arr_elem_conv;
1454 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1456 return (uint64_t)ret;
1458 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1459 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1460 for (size_t i = 0; i < ret.datalen; i++) {
1461 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1465 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1466 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1467 static jclass LDKErrorAction_IgnoreError_class = NULL;
1468 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1469 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1470 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1472 LDKErrorAction_DisconnectPeer_class =
1473 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1474 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1475 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1476 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1477 LDKErrorAction_IgnoreError_class =
1478 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1479 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1480 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1481 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1482 LDKErrorAction_SendErrorMessage_class =
1483 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1484 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1485 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1486 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1488 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1489 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1491 case LDKErrorAction_DisconnectPeer: {
1492 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1493 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1494 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1495 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1496 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1498 case LDKErrorAction_IgnoreError: {
1499 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1501 case LDKErrorAction_SendErrorMessage: {
1502 LDKErrorMessage msg_var = obj->send_error_message.msg;
1503 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1504 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1505 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1506 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1511 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1512 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1513 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1514 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1515 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1516 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1518 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1519 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1520 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1521 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1522 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1523 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1524 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1525 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1526 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1527 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1528 LDKHTLCFailChannelUpdate_NodeFailure_class =
1529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1530 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1531 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1532 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1534 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1535 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1537 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1538 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1539 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1540 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1541 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1542 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1544 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1545 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1547 case LDKHTLCFailChannelUpdate_NodeFailure: {
1548 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1549 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1550 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1555 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1556 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1557 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1558 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1559 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1560 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1561 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1562 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1563 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1564 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1565 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1566 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1567 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1568 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1569 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1570 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1571 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1572 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1573 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1574 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1575 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1576 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1577 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1578 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1579 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1580 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1581 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1582 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1583 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1584 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1585 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1586 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1587 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1588 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1589 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1590 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1591 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1592 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1594 LDKMessageSendEvent_SendAcceptChannel_class =
1595 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1596 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1597 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1598 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1599 LDKMessageSendEvent_SendOpenChannel_class =
1600 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1601 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1602 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1603 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1604 LDKMessageSendEvent_SendFundingCreated_class =
1605 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1606 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1607 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1608 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1609 LDKMessageSendEvent_SendFundingSigned_class =
1610 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1611 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1612 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1613 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1614 LDKMessageSendEvent_SendFundingLocked_class =
1615 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1616 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1617 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1618 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1619 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1620 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1621 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1622 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1623 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1624 LDKMessageSendEvent_UpdateHTLCs_class =
1625 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1626 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1627 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1628 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1629 LDKMessageSendEvent_SendRevokeAndACK_class =
1630 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1631 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1632 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1633 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1634 LDKMessageSendEvent_SendClosingSigned_class =
1635 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1636 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1637 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1638 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1639 LDKMessageSendEvent_SendShutdown_class =
1640 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1641 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1642 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1643 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1644 LDKMessageSendEvent_SendChannelReestablish_class =
1645 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1646 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1647 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1648 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1649 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1651 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1652 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1653 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1654 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1655 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1656 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1657 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1658 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1659 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1660 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1661 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1662 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1663 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1664 LDKMessageSendEvent_HandleError_class =
1665 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1666 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1667 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1668 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1669 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1670 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1671 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1672 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1673 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1674 LDKMessageSendEvent_SendChannelRangeQuery_class =
1675 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1676 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1677 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1678 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1679 LDKMessageSendEvent_SendShortIdsQuery_class =
1680 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1681 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1682 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1683 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1684 LDKMessageSendEvent_SendReplyChannelRange_class =
1685 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1686 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1687 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1688 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1690 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1691 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1693 case LDKMessageSendEvent_SendAcceptChannel: {
1694 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1695 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1696 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1697 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1698 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1699 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1700 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1702 case LDKMessageSendEvent_SendOpenChannel: {
1703 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1704 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1705 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1706 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1707 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1708 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1709 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1711 case LDKMessageSendEvent_SendFundingCreated: {
1712 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1713 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1714 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1715 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1716 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1717 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1718 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1720 case LDKMessageSendEvent_SendFundingSigned: {
1721 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1722 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1723 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1724 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1725 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1726 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1727 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1729 case LDKMessageSendEvent_SendFundingLocked: {
1730 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1731 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1732 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1733 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1734 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1735 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1736 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1738 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1739 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1740 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1741 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1742 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1743 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1744 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1745 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1747 case LDKMessageSendEvent_UpdateHTLCs: {
1748 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1749 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1750 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1751 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1752 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1753 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1754 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1756 case LDKMessageSendEvent_SendRevokeAndACK: {
1757 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1758 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1759 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1760 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1761 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1762 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1763 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1765 case LDKMessageSendEvent_SendClosingSigned: {
1766 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1767 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1768 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1769 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1770 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1771 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1772 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1774 case LDKMessageSendEvent_SendShutdown: {
1775 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1776 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1777 LDKShutdown msg_var = obj->send_shutdown.msg;
1778 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1779 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1780 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1781 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1783 case LDKMessageSendEvent_SendChannelReestablish: {
1784 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1785 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1786 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1787 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1788 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1789 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1790 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1792 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1793 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1794 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1795 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1796 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1797 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1798 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1799 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1800 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1801 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1803 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1804 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1805 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1806 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1807 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1808 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1810 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1811 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1812 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1813 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1814 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1815 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1817 case LDKMessageSendEvent_HandleError: {
1818 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1819 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1820 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1821 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1823 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1824 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1825 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1827 case LDKMessageSendEvent_SendChannelRangeQuery: {
1828 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1829 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1830 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1833 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1834 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1836 case LDKMessageSendEvent_SendShortIdsQuery: {
1837 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1838 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1839 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1840 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1843 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1845 case LDKMessageSendEvent_SendReplyChannelRange: {
1846 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1847 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1848 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1849 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1852 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1858 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1859 ret->datalen = (*env)->GetArrayLength(env, elems);
1860 if (ret->datalen == 0) {
1863 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1864 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1865 for (size_t i = 0; i < ret->datalen; i++) {
1866 int64_t arr_elem = java_elems[i];
1867 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1868 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1869 ret->data[i] = arr_elem_conv;
1871 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1873 return (uint64_t)ret;
1875 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1876 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1877 for (size_t i = 0; i < ret.datalen; i++) {
1878 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1883 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1886 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1887 CHECK(val->result_ok);
1888 LDKInitFeatures res_var = (*val->contents.result);
1889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1895 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1896 CHECK(!val->result_ok);
1897 LDKDecodeError err_var = (*val->contents.err);
1898 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1899 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1900 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1904 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1907 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1908 CHECK(val->result_ok);
1909 LDKNodeFeatures res_var = (*val->contents.result);
1910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1916 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1917 CHECK(!val->result_ok);
1918 LDKDecodeError err_var = (*val->contents.err);
1919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1925 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1928 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1929 CHECK(val->result_ok);
1930 LDKChannelFeatures res_var = (*val->contents.result);
1931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1937 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1938 CHECK(!val->result_ok);
1939 LDKDecodeError err_var = (*val->contents.err);
1940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1946 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1949 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1950 CHECK(val->result_ok);
1951 LDKInvoiceFeatures res_var = (*val->contents.result);
1952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1958 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1959 CHECK(!val->result_ok);
1960 LDKDecodeError err_var = (*val->contents.err);
1961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1967 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1970 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1971 CHECK(val->result_ok);
1972 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1979 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1980 CHECK(!val->result_ok);
1981 LDKDecodeError err_var = (*val->contents.err);
1982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1988 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1991 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1992 CHECK(val->result_ok);
1993 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1994 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1995 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1996 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2000 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2001 CHECK(!val->result_ok);
2002 LDKDecodeError err_var = (*val->contents.err);
2003 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2004 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2005 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2009 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2012 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2013 CHECK(val->result_ok);
2014 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2018 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2019 CHECK(!val->result_ok);
2020 LDKDecodeError err_var = (*val->contents.err);
2021 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2022 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2023 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2027 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2029 CHECK((*env)->GetArrayLength(env, a) == 64);
2030 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2032 LDKCVec_SignatureZ b_constr;
2033 b_constr.datalen = (*env)->GetArrayLength(env, b);
2034 if (b_constr.datalen > 0)
2035 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2037 b_constr.data = NULL;
2038 for (size_t i = 0; i < b_constr.datalen; i++) {
2039 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2040 LDKSignature b_conv_8_ref;
2041 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2042 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2043 b_constr.data[i] = b_conv_8_ref;
2046 return (uint64_t)ret;
2048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2049 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2050 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2051 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2054 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2055 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2056 LDKCVec_SignatureZ b_var = tuple->b;
2057 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2059 for (size_t i = 0; i < b_var.datalen; i++) {
2060 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2061 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2062 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2067 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2070 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2071 CHECK(val->result_ok);
2072 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2076 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2077 CHECK(!val->result_ok);
2078 return *val->contents.err;
2080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2081 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2084 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2085 CHECK(val->result_ok);
2086 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2087 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2091 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2092 CHECK(!val->result_ok);
2093 return *val->contents.err;
2095 typedef struct LDKBaseSign_JCalls {
2096 atomic_size_t refcnt;
2099 jmethodID get_per_commitment_point_meth;
2100 jmethodID release_commitment_secret_meth;
2101 jmethodID channel_keys_id_meth;
2102 jmethodID sign_counterparty_commitment_meth;
2103 jmethodID sign_holder_commitment_and_htlcs_meth;
2104 jmethodID sign_justice_revoked_output_meth;
2105 jmethodID sign_justice_revoked_htlc_meth;
2106 jmethodID sign_counterparty_htlc_transaction_meth;
2107 jmethodID sign_closing_transaction_meth;
2108 jmethodID sign_channel_announcement_meth;
2109 jmethodID ready_channel_meth;
2110 } LDKBaseSign_JCalls;
2111 static void LDKBaseSign_JCalls_free(void* this_arg) {
2112 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2113 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2116 if (get_jenv_res == JNI_EDETACHED) {
2117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2119 DO_ASSERT(get_jenv_res == JNI_OK);
2121 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2122 if (get_jenv_res == JNI_EDETACHED) {
2123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2128 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2129 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2131 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2132 if (get_jenv_res == JNI_EDETACHED) {
2133 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2135 DO_ASSERT(get_jenv_res == JNI_OK);
2137 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2139 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2140 LDKPublicKey ret_ref;
2141 CHECK((*env)->GetArrayLength(env, ret) == 33);
2142 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2143 if (get_jenv_res == JNI_EDETACHED) {
2144 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2148 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2149 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2151 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2152 if (get_jenv_res == JNI_EDETACHED) {
2153 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2155 DO_ASSERT(get_jenv_res == JNI_OK);
2157 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2159 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2160 LDKThirtyTwoBytes ret_ref;
2161 CHECK((*env)->GetArrayLength(env, ret) == 32);
2162 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2163 if (get_jenv_res == JNI_EDETACHED) {
2164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2168 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2169 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2171 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2172 if (get_jenv_res == JNI_EDETACHED) {
2173 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2175 DO_ASSERT(get_jenv_res == JNI_OK);
2177 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2179 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2180 LDKThirtyTwoBytes ret_ref;
2181 CHECK((*env)->GetArrayLength(env, ret) == 32);
2182 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2183 if (get_jenv_res == JNI_EDETACHED) {
2184 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2188 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2189 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2191 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2192 if (get_jenv_res == JNI_EDETACHED) {
2193 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2195 DO_ASSERT(get_jenv_res == JNI_OK);
2197 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2198 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2199 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2200 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2201 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2202 if (commitment_tx_var.is_owned) {
2203 commitment_tx_ref |= 1;
2205 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2207 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2208 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2209 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2210 if (get_jenv_res == JNI_EDETACHED) {
2211 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2215 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2216 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2218 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2219 if (get_jenv_res == JNI_EDETACHED) {
2220 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2222 DO_ASSERT(get_jenv_res == JNI_OK);
2224 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2225 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2226 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2227 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2228 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2229 if (commitment_tx_var.is_owned) {
2230 commitment_tx_ref |= 1;
2232 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2234 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2235 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2236 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2237 if (get_jenv_res == JNI_EDETACHED) {
2238 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2242 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]) {
2243 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2245 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2246 if (get_jenv_res == JNI_EDETACHED) {
2247 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2249 DO_ASSERT(get_jenv_res == JNI_OK);
2251 LDKTransaction justice_tx_var = justice_tx;
2252 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2253 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2254 Transaction_free(justice_tx_var);
2255 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2256 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2257 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2259 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2260 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2261 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2262 if (get_jenv_res == JNI_EDETACHED) {
2263 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2267 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) {
2268 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2270 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2271 if (get_jenv_res == JNI_EDETACHED) {
2272 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2274 DO_ASSERT(get_jenv_res == JNI_OK);
2276 LDKTransaction justice_tx_var = justice_tx;
2277 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2278 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2279 Transaction_free(justice_tx_var);
2280 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2281 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2282 LDKHTLCOutputInCommitment htlc_var = *htlc;
2283 htlc_var = HTLCOutputInCommitment_clone(htlc);
2284 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2285 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2286 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2287 if (htlc_var.is_owned) {
2290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2292 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2293 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2294 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2295 if (get_jenv_res == JNI_EDETACHED) {
2296 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2300 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) {
2301 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2303 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2304 if (get_jenv_res == JNI_EDETACHED) {
2305 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2307 DO_ASSERT(get_jenv_res == JNI_OK);
2309 LDKTransaction htlc_tx_var = htlc_tx;
2310 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2311 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2312 Transaction_free(htlc_tx_var);
2313 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2314 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2315 LDKHTLCOutputInCommitment htlc_var = *htlc;
2316 htlc_var = HTLCOutputInCommitment_clone(htlc);
2317 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2318 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2319 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2320 if (htlc_var.is_owned) {
2323 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2325 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2326 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2327 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2328 if (get_jenv_res == JNI_EDETACHED) {
2329 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2333 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2334 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2336 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2337 if (get_jenv_res == JNI_EDETACHED) {
2338 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2340 DO_ASSERT(get_jenv_res == JNI_OK);
2342 LDKTransaction closing_tx_var = closing_tx;
2343 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2344 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2345 Transaction_free(closing_tx_var);
2346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2348 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2349 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2350 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2351 if (get_jenv_res == JNI_EDETACHED) {
2352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2356 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2357 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2359 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2360 if (get_jenv_res == JNI_EDETACHED) {
2361 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2363 DO_ASSERT(get_jenv_res == JNI_OK);
2365 LDKUnsignedChannelAnnouncement msg_var = *msg;
2366 msg_var = UnsignedChannelAnnouncement_clone(msg);
2367 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2368 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2369 uint64_t msg_ref = (uint64_t)msg_var.inner;
2370 if (msg_var.is_owned) {
2373 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2375 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2376 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2377 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2378 if (get_jenv_res == JNI_EDETACHED) {
2379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2383 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2384 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2386 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2387 if (get_jenv_res == JNI_EDETACHED) {
2388 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2390 DO_ASSERT(get_jenv_res == JNI_OK);
2392 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2393 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2394 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2395 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2396 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2397 if (channel_parameters_var.is_owned) {
2398 channel_parameters_ref |= 1;
2400 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2402 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2403 if (get_jenv_res == JNI_EDETACHED) {
2404 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2407 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2408 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2409 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2410 return (void*) this_arg;
2412 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2413 jclass c = (*env)->GetObjectClass(env, o);
2415 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2416 atomic_init(&calls->refcnt, 1);
2417 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2418 calls->o = (*env)->NewWeakGlobalRef(env, o);
2419 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2420 CHECK(calls->get_per_commitment_point_meth != NULL);
2421 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2422 CHECK(calls->release_commitment_secret_meth != NULL);
2423 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2424 CHECK(calls->channel_keys_id_meth != NULL);
2425 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2426 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2427 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2428 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2429 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2430 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2431 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2432 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2433 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2434 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2435 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2436 CHECK(calls->sign_closing_transaction_meth != NULL);
2437 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2438 CHECK(calls->sign_channel_announcement_meth != NULL);
2439 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2440 CHECK(calls->ready_channel_meth != NULL);
2442 LDKChannelPublicKeys pubkeys_conv;
2443 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2444 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2445 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2448 .this_arg = (void*) calls,
2449 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2450 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2451 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2452 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2453 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2454 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2455 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2456 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2457 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2458 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2459 .ready_channel = ready_channel_LDKBaseSign_jcall,
2460 .free = LDKBaseSign_JCalls_free,
2461 .pubkeys = pubkeys_conv,
2462 .set_pubkeys = NULL,
2466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2467 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2468 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2469 return (uint64_t)res_ptr;
2471 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) {
2472 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2473 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2474 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2479 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2480 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2481 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2486 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2487 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2488 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2492 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) {
2493 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2494 LDKCommitmentTransaction commitment_tx_conv;
2495 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2496 commitment_tx_conv.is_owned = false;
2497 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2498 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2499 return (uint64_t)ret_conv;
2502 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) {
2503 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2504 LDKHolderCommitmentTransaction commitment_tx_conv;
2505 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2506 commitment_tx_conv.is_owned = false;
2507 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2508 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2509 return (uint64_t)ret_conv;
2512 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) {
2513 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2514 LDKTransaction justice_tx_ref;
2515 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2516 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2517 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2518 justice_tx_ref.data_is_owned = true;
2519 unsigned char per_commitment_key_arr[32];
2520 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2521 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2522 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2523 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2524 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2525 return (uint64_t)ret_conv;
2528 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) {
2529 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2530 LDKTransaction justice_tx_ref;
2531 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2532 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2533 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2534 justice_tx_ref.data_is_owned = true;
2535 unsigned char per_commitment_key_arr[32];
2536 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2537 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2538 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2539 LDKHTLCOutputInCommitment htlc_conv;
2540 htlc_conv.inner = (void*)(htlc & (~1));
2541 htlc_conv.is_owned = false;
2542 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2543 *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);
2544 return (uint64_t)ret_conv;
2547 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) {
2548 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2549 LDKTransaction htlc_tx_ref;
2550 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2551 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2552 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2553 htlc_tx_ref.data_is_owned = true;
2554 LDKPublicKey per_commitment_point_ref;
2555 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2556 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2557 LDKHTLCOutputInCommitment htlc_conv;
2558 htlc_conv.inner = (void*)(htlc & (~1));
2559 htlc_conv.is_owned = false;
2560 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2561 *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);
2562 return (uint64_t)ret_conv;
2565 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) {
2566 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2567 LDKTransaction closing_tx_ref;
2568 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2569 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2570 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2571 closing_tx_ref.data_is_owned = true;
2572 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2573 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2574 return (uint64_t)ret_conv;
2577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2578 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2579 LDKUnsignedChannelAnnouncement msg_conv;
2580 msg_conv.inner = (void*)(msg & (~1));
2581 msg_conv.is_owned = false;
2582 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2583 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2584 return (uint64_t)ret_conv;
2587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2588 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2589 LDKChannelTransactionParameters channel_parameters_conv;
2590 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2591 channel_parameters_conv.is_owned = false;
2592 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2595 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2596 if (this_arg->set_pubkeys != NULL)
2597 this_arg->set_pubkeys(this_arg);
2598 return this_arg->pubkeys;
2600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2601 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2602 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2605 uint64_t ret_ref = (uint64_t)ret_var.inner;
2606 if (ret_var.is_owned) {
2612 typedef struct LDKSign_JCalls {
2613 atomic_size_t refcnt;
2616 LDKBaseSign_JCalls* BaseSign;
2617 jmethodID write_meth;
2619 static void LDKSign_JCalls_free(void* this_arg) {
2620 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2621 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2623 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2624 if (get_jenv_res == JNI_EDETACHED) {
2625 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2627 DO_ASSERT(get_jenv_res == JNI_OK);
2629 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2630 if (get_jenv_res == JNI_EDETACHED) {
2631 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2636 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2637 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2640 if (get_jenv_res == JNI_EDETACHED) {
2641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2643 DO_ASSERT(get_jenv_res == JNI_OK);
2645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2647 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2648 LDKCVec_u8Z ret_ref;
2649 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2650 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2651 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2652 if (get_jenv_res == JNI_EDETACHED) {
2653 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2657 static void* LDKSign_JCalls_clone(const void* this_arg) {
2658 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2659 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2660 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2661 return (void*) this_arg;
2663 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2664 jclass c = (*env)->GetObjectClass(env, o);
2666 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2667 atomic_init(&calls->refcnt, 1);
2668 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2669 calls->o = (*env)->NewWeakGlobalRef(env, o);
2670 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2671 CHECK(calls->write_meth != NULL);
2673 LDKChannelPublicKeys pubkeys_conv;
2674 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2675 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2676 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2679 .this_arg = (void*) calls,
2680 .write = write_LDKSign_jcall,
2681 .clone = LDKSign_JCalls_clone,
2682 .free = LDKSign_JCalls_free,
2683 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2685 calls->BaseSign = ret.BaseSign.this_arg;
2688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2689 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2690 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2691 return (uint64_t)res_ptr;
2693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2694 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2695 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2696 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2697 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2698 CVec_u8Z_free(ret_var);
2702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2703 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2706 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2707 CHECK(val->result_ok);
2708 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2709 *ret = Sign_clone(&(*val->contents.result));
2710 return (uint64_t)ret;
2712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2713 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2714 CHECK(!val->result_ok);
2715 LDKDecodeError err_var = (*val->contents.err);
2716 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2717 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2718 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2722 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2725 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2726 CHECK(val->result_ok);
2727 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2728 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2732 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2733 CHECK(!val->result_ok);
2734 return *val->contents.err;
2736 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2737 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2738 for (size_t i = 0; i < ret.datalen; i++) {
2739 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2744 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2746 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2747 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2748 CHECK(val->result_ok);
2749 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2750 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2752 for (size_t i = 0; i < res_var.datalen; i++) {
2753 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2754 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2755 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2756 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2761 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2762 CHECK(!val->result_ok);
2763 return *val->contents.err;
2765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2766 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2769 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2770 CHECK(val->result_ok);
2771 LDKInMemorySigner res_var = (*val->contents.result);
2772 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2773 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2774 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2778 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2779 CHECK(!val->result_ok);
2780 LDKDecodeError err_var = (*val->contents.err);
2781 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2782 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2783 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2787 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2788 ret->datalen = (*env)->GetArrayLength(env, elems);
2789 if (ret->datalen == 0) {
2792 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2793 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2794 for (size_t i = 0; i < ret->datalen; i++) {
2795 int64_t arr_elem = java_elems[i];
2796 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2797 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2798 ret->data[i] = arr_elem_conv;
2800 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2802 return (uint64_t)ret;
2804 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2805 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2806 for (size_t i = 0; i < ret.datalen; i++) {
2807 ret.data[i] = TxOut_clone(&orig->data[i]);
2811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2812 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2815 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2816 CHECK(val->result_ok);
2817 LDKTransaction res_var = (*val->contents.result);
2818 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2819 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2823 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2824 CHECK(!val->result_ok);
2825 return *val->contents.err;
2827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2828 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2829 LDKThirtyTwoBytes a_ref;
2830 CHECK((*env)->GetArrayLength(env, a) == 32);
2831 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2833 LDKChannelMonitor b_conv;
2834 b_conv.inner = (void*)(b & (~1));
2835 b_conv.is_owned = (b & 1) || (b == 0);
2836 b_conv = ChannelMonitor_clone(&b_conv);
2838 return (uint64_t)ret;
2840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2841 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2842 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2843 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2847 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2848 LDKChannelMonitor b_var = tuple->b;
2849 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2850 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2851 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2855 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2856 ret->datalen = (*env)->GetArrayLength(env, elems);
2857 if (ret->datalen == 0) {
2860 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2861 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2862 for (size_t i = 0; i < ret->datalen; i++) {
2863 int64_t arr_elem = java_elems[i];
2864 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2865 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2866 ret->data[i] = arr_elem_conv;
2868 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2870 return (uint64_t)ret;
2872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2873 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2875 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2876 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2877 CHECK(val->result_ok);
2878 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2879 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2880 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2881 for (size_t i = 0; i < res_var.datalen; i++) {
2882 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2883 res_arr_ptr[i] = res_conv_34_ref;
2885 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2888 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2889 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2890 CHECK(!val->result_ok);
2891 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2894 static jclass LDKAPIError_APIMisuseError_class = NULL;
2895 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2896 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2897 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2898 static jclass LDKAPIError_RouteError_class = NULL;
2899 static jmethodID LDKAPIError_RouteError_meth = NULL;
2900 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2901 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2902 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2903 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2905 LDKAPIError_APIMisuseError_class =
2906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2907 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2908 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2909 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2910 LDKAPIError_FeeRateTooHigh_class =
2911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2912 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2913 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2914 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2915 LDKAPIError_RouteError_class =
2916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2917 CHECK(LDKAPIError_RouteError_class != NULL);
2918 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2919 CHECK(LDKAPIError_RouteError_meth != NULL);
2920 LDKAPIError_ChannelUnavailable_class =
2921 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2922 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2923 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2924 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2925 LDKAPIError_MonitorUpdateFailed_class =
2926 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2927 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2928 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2929 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2931 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2932 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2934 case LDKAPIError_APIMisuseError: {
2935 LDKStr err_str = obj->api_misuse_error.err;
2936 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2937 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2939 case LDKAPIError_FeeRateTooHigh: {
2940 LDKStr err_str = obj->fee_rate_too_high.err;
2941 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2942 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2944 case LDKAPIError_RouteError: {
2945 LDKStr err_str = obj->route_error.err;
2946 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2947 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2949 case LDKAPIError_ChannelUnavailable: {
2950 LDKStr err_str = obj->channel_unavailable.err;
2951 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2952 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
2954 case LDKAPIError_MonitorUpdateFailed: {
2955 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2961 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2964 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2965 CHECK(val->result_ok);
2966 return *val->contents.result;
2968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2969 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2970 CHECK(!val->result_ok);
2971 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2975 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2976 ret->datalen = (*env)->GetArrayLength(env, elems);
2977 if (ret->datalen == 0) {
2980 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2981 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2982 for (size_t i = 0; i < ret->datalen; i++) {
2983 int64_t arr_elem = java_elems[i];
2984 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2985 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2986 ret->data[i] = arr_elem_conv;
2988 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2990 return (uint64_t)ret;
2992 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2993 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2994 for (size_t i = 0; i < ret.datalen; i++) {
2995 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3000 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3001 ret->datalen = (*env)->GetArrayLength(env, elems);
3002 if (ret->datalen == 0) {
3005 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3006 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3007 for (size_t i = 0; i < ret->datalen; i++) {
3008 int64_t arr_elem = java_elems[i];
3009 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3010 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3011 ret->data[i] = arr_elem_conv;
3013 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3015 return (uint64_t)ret;
3017 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3018 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3019 for (size_t i = 0; i < ret.datalen; i++) {
3020 ret.data[i] = APIError_clone(&orig->data[i]);
3024 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3025 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3026 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3027 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3028 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3029 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3030 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3031 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3033 LDKPaymentSendFailure_ParameterError_class =
3034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3035 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3036 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3037 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3038 LDKPaymentSendFailure_PathParameterError_class =
3039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3040 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3041 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3042 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3043 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3045 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3046 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3047 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3048 LDKPaymentSendFailure_PartialFailure_class =
3049 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3050 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3051 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3052 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3054 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3055 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3057 case LDKPaymentSendFailure_ParameterError: {
3058 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3059 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3061 case LDKPaymentSendFailure_PathParameterError: {
3062 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3063 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3064 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3065 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3066 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3067 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3068 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3069 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3071 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3072 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3074 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3075 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3076 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3077 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3078 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3079 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3080 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3082 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3083 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3085 case LDKPaymentSendFailure_PartialFailure: {
3086 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3087 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3088 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3089 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3090 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3091 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3092 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3093 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3095 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3096 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3102 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3105 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3106 CHECK(val->result_ok);
3107 return *val->contents.result;
3109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3110 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3111 CHECK(!val->result_ok);
3112 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3115 static jclass LDKNetAddress_IPv4_class = NULL;
3116 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3117 static jclass LDKNetAddress_IPv6_class = NULL;
3118 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3119 static jclass LDKNetAddress_OnionV2_class = NULL;
3120 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3121 static jclass LDKNetAddress_OnionV3_class = NULL;
3122 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3124 LDKNetAddress_IPv4_class =
3125 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3126 CHECK(LDKNetAddress_IPv4_class != NULL);
3127 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3128 CHECK(LDKNetAddress_IPv4_meth != NULL);
3129 LDKNetAddress_IPv6_class =
3130 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3131 CHECK(LDKNetAddress_IPv6_class != NULL);
3132 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3133 CHECK(LDKNetAddress_IPv6_meth != NULL);
3134 LDKNetAddress_OnionV2_class =
3135 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3136 CHECK(LDKNetAddress_OnionV2_class != NULL);
3137 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3138 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3139 LDKNetAddress_OnionV3_class =
3140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3141 CHECK(LDKNetAddress_OnionV3_class != NULL);
3142 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3143 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3145 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3146 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3148 case LDKNetAddress_IPv4: {
3149 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3150 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3151 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3153 case LDKNetAddress_IPv6: {
3154 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3155 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3156 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3158 case LDKNetAddress_OnionV2: {
3159 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3160 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3161 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3163 case LDKNetAddress_OnionV3: {
3164 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3165 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3166 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);
3171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3172 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3173 ret->datalen = (*env)->GetArrayLength(env, elems);
3174 if (ret->datalen == 0) {
3177 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3178 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3179 for (size_t i = 0; i < ret->datalen; i++) {
3180 int64_t arr_elem = java_elems[i];
3181 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3182 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3183 ret->data[i] = arr_elem_conv;
3185 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3187 return (uint64_t)ret;
3189 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3190 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3191 for (size_t i = 0; i < ret.datalen; i++) {
3192 ret.data[i] = NetAddress_clone(&orig->data[i]);
3196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3197 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3198 LDKThirtyTwoBytes a_ref;
3199 CHECK((*env)->GetArrayLength(env, a) == 32);
3200 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3202 LDKThirtyTwoBytes b_ref;
3203 CHECK((*env)->GetArrayLength(env, b) == 32);
3204 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3206 return (uint64_t)ret;
3208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3209 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3210 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3211 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3215 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3216 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3217 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3221 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3224 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3225 CHECK(val->result_ok);
3226 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3227 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3231 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3232 CHECK(!val->result_ok);
3233 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3237 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3238 ret->datalen = (*env)->GetArrayLength(env, elems);
3239 if (ret->datalen == 0) {
3242 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3243 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3244 for (size_t i = 0; i < ret->datalen; i++) {
3245 int64_t arr_elem = java_elems[i];
3246 LDKChannelMonitor arr_elem_conv;
3247 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3248 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3249 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3250 ret->data[i] = arr_elem_conv;
3252 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3254 return (uint64_t)ret;
3256 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3257 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3258 for (size_t i = 0; i < ret.datalen; i++) {
3259 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3263 typedef struct LDKWatch_JCalls {
3264 atomic_size_t refcnt;
3267 jmethodID watch_channel_meth;
3268 jmethodID update_channel_meth;
3269 jmethodID release_pending_monitor_events_meth;
3271 static void LDKWatch_JCalls_free(void* this_arg) {
3272 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3273 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3275 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3276 if (get_jenv_res == JNI_EDETACHED) {
3277 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3279 DO_ASSERT(get_jenv_res == JNI_OK);
3281 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3282 if (get_jenv_res == JNI_EDETACHED) {
3283 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3288 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3289 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3291 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3292 if (get_jenv_res == JNI_EDETACHED) {
3293 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3295 DO_ASSERT(get_jenv_res == JNI_OK);
3297 LDKOutPoint funding_txo_var = funding_txo;
3298 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3299 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3300 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3301 if (funding_txo_var.is_owned) {
3302 funding_txo_ref |= 1;
3304 LDKChannelMonitor monitor_var = monitor;
3305 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3306 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3307 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3308 if (monitor_var.is_owned) {
3311 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3313 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3314 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3315 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3316 if (get_jenv_res == JNI_EDETACHED) {
3317 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3321 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3322 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3324 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3325 if (get_jenv_res == JNI_EDETACHED) {
3326 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3328 DO_ASSERT(get_jenv_res == JNI_OK);
3330 LDKOutPoint funding_txo_var = funding_txo;
3331 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3332 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3333 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3334 if (funding_txo_var.is_owned) {
3335 funding_txo_ref |= 1;
3337 LDKChannelMonitorUpdate update_var = update;
3338 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3339 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3340 uint64_t update_ref = (uint64_t)update_var.inner;
3341 if (update_var.is_owned) {
3344 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3346 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3347 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3348 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3349 if (get_jenv_res == JNI_EDETACHED) {
3350 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3354 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3355 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3357 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3358 if (get_jenv_res == JNI_EDETACHED) {
3359 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3361 DO_ASSERT(get_jenv_res == JNI_OK);
3363 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3365 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3366 LDKCVec_MonitorEventZ ret_constr;
3367 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3368 if (ret_constr.datalen > 0)
3369 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3371 ret_constr.data = NULL;
3372 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3373 for (size_t o = 0; o < ret_constr.datalen; o++) {
3374 int64_t ret_conv_14 = ret_vals[o];
3375 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3376 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3377 ret_constr.data[o] = ret_conv_14_conv;
3379 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3380 if (get_jenv_res == JNI_EDETACHED) {
3381 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3385 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3386 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3387 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3388 return (void*) this_arg;
3390 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3391 jclass c = (*env)->GetObjectClass(env, o);
3393 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3394 atomic_init(&calls->refcnt, 1);
3395 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3396 calls->o = (*env)->NewWeakGlobalRef(env, o);
3397 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3398 CHECK(calls->watch_channel_meth != NULL);
3399 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3400 CHECK(calls->update_channel_meth != NULL);
3401 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3402 CHECK(calls->release_pending_monitor_events_meth != NULL);
3405 .this_arg = (void*) calls,
3406 .watch_channel = watch_channel_LDKWatch_jcall,
3407 .update_channel = update_channel_LDKWatch_jcall,
3408 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3409 .free = LDKWatch_JCalls_free,
3413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3414 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3415 *res_ptr = LDKWatch_init(env, clz, o);
3416 return (uint64_t)res_ptr;
3418 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) {
3419 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3420 LDKOutPoint funding_txo_conv;
3421 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3422 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3423 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3424 LDKChannelMonitor monitor_conv;
3425 monitor_conv.inner = (void*)(monitor & (~1));
3426 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3427 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3428 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3429 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3430 return (uint64_t)ret_conv;
3433 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) {
3434 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3435 LDKOutPoint funding_txo_conv;
3436 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3437 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3438 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3439 LDKChannelMonitorUpdate update_conv;
3440 update_conv.inner = (void*)(update & (~1));
3441 update_conv.is_owned = (update & 1) || (update == 0);
3442 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3443 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3444 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3445 return (uint64_t)ret_conv;
3448 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3449 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3450 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3451 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3452 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3453 for (size_t o = 0; o < ret_var.datalen; o++) {
3454 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3455 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3456 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3457 ret_arr_ptr[o] = ret_conv_14_ref;
3459 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3464 typedef struct LDKBroadcasterInterface_JCalls {
3465 atomic_size_t refcnt;
3468 jmethodID broadcast_transaction_meth;
3469 } LDKBroadcasterInterface_JCalls;
3470 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3471 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3472 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3474 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3475 if (get_jenv_res == JNI_EDETACHED) {
3476 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3478 DO_ASSERT(get_jenv_res == JNI_OK);
3480 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3481 if (get_jenv_res == JNI_EDETACHED) {
3482 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3487 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3488 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3490 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3491 if (get_jenv_res == JNI_EDETACHED) {
3492 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3494 DO_ASSERT(get_jenv_res == JNI_OK);
3496 LDKTransaction tx_var = tx;
3497 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3498 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3499 Transaction_free(tx_var);
3500 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3502 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3503 if (get_jenv_res == JNI_EDETACHED) {
3504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3507 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3508 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3509 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3510 return (void*) this_arg;
3512 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3513 jclass c = (*env)->GetObjectClass(env, o);
3515 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3516 atomic_init(&calls->refcnt, 1);
3517 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3518 calls->o = (*env)->NewWeakGlobalRef(env, o);
3519 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3520 CHECK(calls->broadcast_transaction_meth != NULL);
3522 LDKBroadcasterInterface ret = {
3523 .this_arg = (void*) calls,
3524 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3525 .free = LDKBroadcasterInterface_JCalls_free,
3529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3530 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3531 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3532 return (uint64_t)res_ptr;
3534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3535 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3536 LDKTransaction tx_ref;
3537 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3538 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3539 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3540 tx_ref.data_is_owned = true;
3541 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3544 typedef struct LDKKeysInterface_JCalls {
3545 atomic_size_t refcnt;
3548 jmethodID get_node_secret_meth;
3549 jmethodID get_destination_script_meth;
3550 jmethodID get_shutdown_pubkey_meth;
3551 jmethodID get_channel_signer_meth;
3552 jmethodID get_secure_random_bytes_meth;
3553 jmethodID read_chan_signer_meth;
3554 jmethodID sign_invoice_meth;
3555 } LDKKeysInterface_JCalls;
3556 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3557 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3558 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3560 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3561 if (get_jenv_res == JNI_EDETACHED) {
3562 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3564 DO_ASSERT(get_jenv_res == JNI_OK);
3566 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3567 if (get_jenv_res == JNI_EDETACHED) {
3568 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3573 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3574 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3576 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3577 if (get_jenv_res == JNI_EDETACHED) {
3578 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3580 DO_ASSERT(get_jenv_res == JNI_OK);
3582 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3584 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3585 LDKSecretKey ret_ref;
3586 CHECK((*env)->GetArrayLength(env, ret) == 32);
3587 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3588 if (get_jenv_res == JNI_EDETACHED) {
3589 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3593 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3594 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3596 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3597 if (get_jenv_res == JNI_EDETACHED) {
3598 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3600 DO_ASSERT(get_jenv_res == JNI_OK);
3602 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3604 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3605 LDKCVec_u8Z ret_ref;
3606 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3607 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3608 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3609 if (get_jenv_res == JNI_EDETACHED) {
3610 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3614 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3615 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3617 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3618 if (get_jenv_res == JNI_EDETACHED) {
3619 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3621 DO_ASSERT(get_jenv_res == JNI_OK);
3623 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3625 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3626 LDKPublicKey ret_ref;
3627 CHECK((*env)->GetArrayLength(env, ret) == 33);
3628 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3629 if (get_jenv_res == JNI_EDETACHED) {
3630 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3634 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3635 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3637 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3638 if (get_jenv_res == JNI_EDETACHED) {
3639 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3641 DO_ASSERT(get_jenv_res == JNI_OK);
3643 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3645 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3646 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3647 ret_conv = Sign_clone(ret);
3648 if (get_jenv_res == JNI_EDETACHED) {
3649 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3653 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3654 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3656 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3657 if (get_jenv_res == JNI_EDETACHED) {
3658 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3660 DO_ASSERT(get_jenv_res == JNI_OK);
3662 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3664 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3665 LDKThirtyTwoBytes ret_ref;
3666 CHECK((*env)->GetArrayLength(env, ret) == 32);
3667 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3668 if (get_jenv_res == JNI_EDETACHED) {
3669 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3673 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3674 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3676 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3677 if (get_jenv_res == JNI_EDETACHED) {
3678 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3680 DO_ASSERT(get_jenv_res == JNI_OK);
3682 LDKu8slice reader_var = reader;
3683 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3684 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3685 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3687 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3688 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3689 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3690 if (get_jenv_res == JNI_EDETACHED) {
3691 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3695 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3696 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3698 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3699 if (get_jenv_res == JNI_EDETACHED) {
3700 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3702 DO_ASSERT(get_jenv_res == JNI_OK);
3704 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3705 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3706 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3707 CVec_u8Z_free(invoice_preimage_var);
3708 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3710 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3711 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3712 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3713 if (get_jenv_res == JNI_EDETACHED) {
3714 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3718 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3719 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3720 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3721 return (void*) this_arg;
3723 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3724 jclass c = (*env)->GetObjectClass(env, o);
3726 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3727 atomic_init(&calls->refcnt, 1);
3728 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3729 calls->o = (*env)->NewWeakGlobalRef(env, o);
3730 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3731 CHECK(calls->get_node_secret_meth != NULL);
3732 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3733 CHECK(calls->get_destination_script_meth != NULL);
3734 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3735 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3736 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3737 CHECK(calls->get_channel_signer_meth != NULL);
3738 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3739 CHECK(calls->get_secure_random_bytes_meth != NULL);
3740 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3741 CHECK(calls->read_chan_signer_meth != NULL);
3742 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3743 CHECK(calls->sign_invoice_meth != NULL);
3745 LDKKeysInterface ret = {
3746 .this_arg = (void*) calls,
3747 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3748 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3749 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3750 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3751 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3752 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3753 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3754 .free = LDKKeysInterface_JCalls_free,
3758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3759 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3760 *res_ptr = LDKKeysInterface_init(env, clz, o);
3761 return (uint64_t)res_ptr;
3763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3764 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3765 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3771 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3772 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3773 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3774 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3775 CVec_u8Z_free(ret_var);
3779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3780 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3781 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3782 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3786 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) {
3787 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3788 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3789 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3790 return (uint64_t)ret;
3793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3794 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3795 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3796 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3801 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3802 LDKu8slice reader_ref;
3803 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3804 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3805 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3806 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3807 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3808 return (uint64_t)ret_conv;
3811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3812 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3813 LDKCVec_u8Z invoice_preimage_ref;
3814 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3815 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3816 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3817 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3818 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3819 return (uint64_t)ret_conv;
3822 typedef struct LDKFeeEstimator_JCalls {
3823 atomic_size_t refcnt;
3826 jmethodID get_est_sat_per_1000_weight_meth;
3827 } LDKFeeEstimator_JCalls;
3828 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3829 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3830 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3832 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3833 if (get_jenv_res == JNI_EDETACHED) {
3834 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3836 DO_ASSERT(get_jenv_res == JNI_OK);
3838 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3839 if (get_jenv_res == JNI_EDETACHED) {
3840 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3845 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3846 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_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 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3855 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3857 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3858 if (get_jenv_res == JNI_EDETACHED) {
3859 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3863 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3864 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3865 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3866 return (void*) this_arg;
3868 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3869 jclass c = (*env)->GetObjectClass(env, o);
3871 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3872 atomic_init(&calls->refcnt, 1);
3873 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3874 calls->o = (*env)->NewWeakGlobalRef(env, o);
3875 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3876 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3878 LDKFeeEstimator ret = {
3879 .this_arg = (void*) calls,
3880 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3881 .free = LDKFeeEstimator_JCalls_free,
3885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3886 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3887 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3888 return (uint64_t)res_ptr;
3890 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) {
3891 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3892 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3893 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3897 typedef struct LDKLogger_JCalls {
3898 atomic_size_t refcnt;
3903 static void LDKLogger_JCalls_free(void* this_arg) {
3904 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3905 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3907 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3908 if (get_jenv_res == JNI_EDETACHED) {
3909 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3911 DO_ASSERT(get_jenv_res == JNI_OK);
3913 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3914 if (get_jenv_res == JNI_EDETACHED) {
3915 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3920 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3921 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3923 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3924 if (get_jenv_res == JNI_EDETACHED) {
3925 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3927 DO_ASSERT(get_jenv_res == JNI_OK);
3929 const char* record_str = record;
3930 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3931 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3933 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3934 if (get_jenv_res == JNI_EDETACHED) {
3935 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3938 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3939 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3940 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3941 return (void*) this_arg;
3943 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3944 jclass c = (*env)->GetObjectClass(env, o);
3946 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3947 atomic_init(&calls->refcnt, 1);
3948 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3949 calls->o = (*env)->NewWeakGlobalRef(env, o);
3950 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3951 CHECK(calls->log_meth != NULL);
3954 .this_arg = (void*) calls,
3955 .log = log_LDKLogger_jcall,
3956 .free = LDKLogger_JCalls_free,
3960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3961 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3962 *res_ptr = LDKLogger_init(env, clz, o);
3963 return (uint64_t)res_ptr;
3965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3966 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3967 LDKThirtyTwoBytes a_ref;
3968 CHECK((*env)->GetArrayLength(env, a) == 32);
3969 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3971 LDKChannelManager b_conv;
3972 b_conv.inner = (void*)(b & (~1));
3973 b_conv.is_owned = (b & 1) || (b == 0);
3974 // Warning: we need a move here but no clone is available for LDKChannelManager
3976 return (uint64_t)ret;
3978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3979 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3980 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3981 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3985 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3986 LDKChannelManager b_var = tuple->b;
3987 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3988 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3989 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3993 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3996 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3997 CHECK(val->result_ok);
3998 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4002 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4003 CHECK(!val->result_ok);
4004 LDKDecodeError err_var = (*val->contents.err);
4005 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4006 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4007 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4011 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4014 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4015 CHECK(val->result_ok);
4016 LDKChannelConfig res_var = (*val->contents.result);
4017 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4018 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4019 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4023 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4024 CHECK(!val->result_ok);
4025 LDKDecodeError err_var = (*val->contents.err);
4026 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4027 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4028 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4032 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4035 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4036 CHECK(val->result_ok);
4037 LDKOutPoint res_var = (*val->contents.result);
4038 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4039 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4040 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4044 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4045 CHECK(!val->result_ok);
4046 LDKDecodeError err_var = (*val->contents.err);
4047 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4048 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4049 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4053 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4056 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4057 CHECK(val->result_ok);
4058 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4062 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4063 CHECK(!val->result_ok);
4064 return *val->contents.err;
4066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4067 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4070 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4071 CHECK(val->result_ok);
4072 LDKInvoice res_var = (*val->contents.result);
4073 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4074 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4075 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4079 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4080 CHECK(!val->result_ok);
4081 return *val->contents.err;
4083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4084 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4087 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4088 CHECK(val->result_ok);
4089 LDKSignedRawInvoice res_var = (*val->contents.result);
4090 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4091 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4092 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4096 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4097 CHECK(!val->result_ok);
4098 return *val->contents.err;
4100 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) {
4101 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4102 LDKRawInvoice a_conv;
4103 a_conv.inner = (void*)(a & (~1));
4104 a_conv.is_owned = (a & 1) || (a == 0);
4105 a_conv = RawInvoice_clone(&a_conv);
4107 LDKThirtyTwoBytes b_ref;
4108 CHECK((*env)->GetArrayLength(env, b) == 32);
4109 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4111 LDKInvoiceSignature c_conv;
4112 c_conv.inner = (void*)(c & (~1));
4113 c_conv.is_owned = (c & 1) || (c == 0);
4114 c_conv = InvoiceSignature_clone(&c_conv);
4116 return (uint64_t)ret;
4118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4119 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4120 LDKRawInvoice a_var = tuple->a;
4121 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4122 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4123 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4127 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4128 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4129 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4133 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4134 LDKInvoiceSignature c_var = tuple->c;
4135 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4136 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4137 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4141 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4144 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4145 CHECK(val->result_ok);
4146 LDKPayeePubKey res_var = (*val->contents.result);
4147 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4148 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4149 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4152 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4153 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4154 CHECK(!val->result_ok);
4155 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4159 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4160 ret->datalen = (*env)->GetArrayLength(env, elems);
4161 if (ret->datalen == 0) {
4164 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4165 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4166 for (size_t i = 0; i < ret->datalen; i++) {
4167 int64_t arr_elem = java_elems[i];
4168 LDKPrivateRoute arr_elem_conv;
4169 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4170 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4171 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4172 ret->data[i] = arr_elem_conv;
4174 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4176 return (uint64_t)ret;
4178 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4179 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4180 for (size_t i = 0; i < ret.datalen; i++) {
4181 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4186 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4189 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4190 CHECK(val->result_ok);
4191 LDKPositiveTimestamp res_var = (*val->contents.result);
4192 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4193 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4194 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4197 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4198 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4199 CHECK(!val->result_ok);
4200 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4204 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4207 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4208 CHECK(val->result_ok);
4209 return *val->contents.result;
4211 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4212 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4213 CHECK(!val->result_ok);
4214 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4218 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4221 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4222 CHECK(val->result_ok);
4223 LDKInvoice res_var = (*val->contents.result);
4224 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4229 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4230 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4231 CHECK(!val->result_ok);
4232 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4236 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4239 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4240 CHECK(val->result_ok);
4241 LDKDescription res_var = (*val->contents.result);
4242 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4243 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4244 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4248 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4249 CHECK(!val->result_ok);
4250 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4254 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4257 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4258 CHECK(val->result_ok);
4259 LDKExpiryTime res_var = (*val->contents.result);
4260 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4261 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4262 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4265 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4266 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4267 CHECK(!val->result_ok);
4268 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4272 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4275 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4276 CHECK(val->result_ok);
4277 LDKPrivateRoute res_var = (*val->contents.result);
4278 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4279 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4280 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4283 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4284 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4285 CHECK(!val->result_ok);
4286 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4290 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4292 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4293 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4294 CHECK(val->result_ok);
4295 LDKStr res_str = (*val->contents.result);
4296 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4300 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4301 CHECK(!val->result_ok);
4302 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4306 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4309 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4310 CHECK(val->result_ok);
4311 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4312 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4313 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4314 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4318 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4319 CHECK(!val->result_ok);
4320 LDKDecodeError err_var = (*val->contents.err);
4321 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4322 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4323 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4327 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4330 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4331 CHECK(val->result_ok);
4332 LDKHTLCUpdate res_var = (*val->contents.result);
4333 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4334 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4335 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4339 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4340 CHECK(!val->result_ok);
4341 LDKDecodeError err_var = (*val->contents.err);
4342 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4343 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4344 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4348 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4351 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4352 CHECK(val->result_ok);
4353 return *val->contents.result;
4355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4356 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4357 CHECK(!val->result_ok);
4358 LDKMonitorUpdateError err_var = (*val->contents.err);
4359 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4360 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4361 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4365 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4367 a_conv.inner = (void*)(a & (~1));
4368 a_conv.is_owned = (a & 1) || (a == 0);
4369 a_conv = OutPoint_clone(&a_conv);
4372 b_ref.datalen = (*env)->GetArrayLength(env, b);
4373 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4374 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4376 return (uint64_t)ret;
4378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4379 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4380 LDKOutPoint a_var = tuple->a;
4381 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4382 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4383 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4387 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4388 LDKCVec_u8Z b_var = tuple->b;
4389 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4390 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4394 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4397 b_ref.datalen = (*env)->GetArrayLength(env, b);
4398 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4399 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4401 return (uint64_t)ret;
4403 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4404 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4408 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4409 LDKCVec_u8Z b_var = tuple->b;
4410 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4411 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4415 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4416 ret->datalen = (*env)->GetArrayLength(env, elems);
4417 if (ret->datalen == 0) {
4420 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4421 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4422 for (size_t i = 0; i < ret->datalen; i++) {
4423 int64_t arr_elem = java_elems[i];
4424 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4425 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4426 ret->data[i] = arr_elem_conv;
4428 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4430 return (uint64_t)ret;
4432 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4433 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4434 for (size_t i = 0; i < ret.datalen; i++) {
4435 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4440 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4441 LDKThirtyTwoBytes a_ref;
4442 CHECK((*env)->GetArrayLength(env, a) == 32);
4443 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4445 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4446 b_constr.datalen = (*env)->GetArrayLength(env, b);
4447 if (b_constr.datalen > 0)
4448 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4450 b_constr.data = NULL;
4451 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4452 for (size_t b = 0; b < b_constr.datalen; b++) {
4453 int64_t b_conv_27 = b_vals[b];
4454 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4455 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4456 b_constr.data[b] = b_conv_27_conv;
4458 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4460 return (uint64_t)ret;
4462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4463 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4464 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4465 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4468 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4469 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4470 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4471 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4472 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4473 for (size_t b = 0; b < b_var.datalen; b++) {
4474 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4475 b_arr_ptr[b] = b_conv_27_ref;
4477 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4481 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4482 ret->datalen = (*env)->GetArrayLength(env, elems);
4483 if (ret->datalen == 0) {
4486 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4487 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4488 for (size_t i = 0; i < ret->datalen; i++) {
4489 int64_t arr_elem = java_elems[i];
4490 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4491 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4492 ret->data[i] = arr_elem_conv;
4494 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4496 return (uint64_t)ret;
4498 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4499 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 };
4500 for (size_t i = 0; i < ret.datalen; i++) {
4501 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4505 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4506 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4507 static jclass LDKEvent_PaymentReceived_class = NULL;
4508 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4509 static jclass LDKEvent_PaymentSent_class = NULL;
4510 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4511 static jclass LDKEvent_PaymentFailed_class = NULL;
4512 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4513 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4514 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4515 static jclass LDKEvent_SpendableOutputs_class = NULL;
4516 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4518 LDKEvent_FundingGenerationReady_class =
4519 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4520 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4521 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4522 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4523 LDKEvent_PaymentReceived_class =
4524 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4525 CHECK(LDKEvent_PaymentReceived_class != NULL);
4526 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4527 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4528 LDKEvent_PaymentSent_class =
4529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4530 CHECK(LDKEvent_PaymentSent_class != NULL);
4531 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4532 CHECK(LDKEvent_PaymentSent_meth != NULL);
4533 LDKEvent_PaymentFailed_class =
4534 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4535 CHECK(LDKEvent_PaymentFailed_class != NULL);
4536 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4537 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4538 LDKEvent_PendingHTLCsForwardable_class =
4539 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4540 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4541 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4542 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4543 LDKEvent_SpendableOutputs_class =
4544 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4545 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4546 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4547 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4549 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4550 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4552 case LDKEvent_FundingGenerationReady: {
4553 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4554 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4555 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4556 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4557 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4558 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);
4560 case LDKEvent_PaymentReceived: {
4561 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4562 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4563 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4564 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4565 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4566 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4567 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
4569 case LDKEvent_PaymentSent: {
4570 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4571 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4572 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4574 case LDKEvent_PaymentFailed: {
4575 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4576 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4577 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4579 case LDKEvent_PendingHTLCsForwardable: {
4580 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4582 case LDKEvent_SpendableOutputs: {
4583 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4584 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4585 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4586 for (size_t b = 0; b < outputs_var.datalen; b++) {
4587 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4588 outputs_arr_ptr[b] = outputs_conv_27_ref;
4590 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4591 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4597 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4598 ret->datalen = (*env)->GetArrayLength(env, elems);
4599 if (ret->datalen == 0) {
4602 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4603 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4604 for (size_t i = 0; i < ret->datalen; i++) {
4605 int64_t arr_elem = java_elems[i];
4606 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4607 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4608 ret->data[i] = arr_elem_conv;
4610 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4612 return (uint64_t)ret;
4614 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4615 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4616 for (size_t i = 0; i < ret.datalen; i++) {
4617 ret.data[i] = Event_clone(&orig->data[i]);
4621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4622 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4624 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4625 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4627 return (uint64_t)ret;
4629 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4630 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4634 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4635 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4636 return (uint64_t)b_ref;
4638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4639 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4640 ret->datalen = (*env)->GetArrayLength(env, elems);
4641 if (ret->datalen == 0) {
4644 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4645 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4646 for (size_t i = 0; i < ret->datalen; i++) {
4647 int64_t arr_elem = java_elems[i];
4648 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4649 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4650 ret->data[i] = arr_elem_conv;
4652 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4654 return (uint64_t)ret;
4656 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4657 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4658 for (size_t i = 0; i < ret.datalen; i++) {
4659 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4664 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4665 LDKThirtyTwoBytes a_ref;
4666 CHECK((*env)->GetArrayLength(env, a) == 32);
4667 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4669 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4670 b_constr.datalen = (*env)->GetArrayLength(env, b);
4671 if (b_constr.datalen > 0)
4672 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4674 b_constr.data = NULL;
4675 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4676 for (size_t a = 0; a < b_constr.datalen; a++) {
4677 int64_t b_conv_26 = b_vals[a];
4678 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4679 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4680 b_constr.data[a] = b_conv_26_conv;
4682 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4684 return (uint64_t)ret;
4686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4687 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4688 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4689 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4692 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4693 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4694 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4695 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4696 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4697 for (size_t a = 0; a < b_var.datalen; a++) {
4698 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4699 b_arr_ptr[a] = b_conv_26_ref;
4701 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4705 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4706 ret->datalen = (*env)->GetArrayLength(env, elems);
4707 if (ret->datalen == 0) {
4710 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4711 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4712 for (size_t i = 0; i < ret->datalen; i++) {
4713 int64_t arr_elem = java_elems[i];
4714 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4715 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4716 ret->data[i] = arr_elem_conv;
4718 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4720 return (uint64_t)ret;
4722 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4723 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 };
4724 for (size_t i = 0; i < ret.datalen; i++) {
4725 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4730 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4733 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4734 CHECK(val->result_ok);
4735 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4739 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4740 CHECK(!val->result_ok);
4741 LDKDecodeError err_var = (*val->contents.err);
4742 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4743 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4744 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4748 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4751 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4752 CHECK(val->result_ok);
4753 return *val->contents.result;
4755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4756 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4757 CHECK(!val->result_ok);
4758 LDKLightningError err_var = (*val->contents.err);
4759 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4760 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4761 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4764 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) {
4765 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4766 LDKChannelAnnouncement a_conv;
4767 a_conv.inner = (void*)(a & (~1));
4768 a_conv.is_owned = (a & 1) || (a == 0);
4769 a_conv = ChannelAnnouncement_clone(&a_conv);
4771 LDKChannelUpdate b_conv;
4772 b_conv.inner = (void*)(b & (~1));
4773 b_conv.is_owned = (b & 1) || (b == 0);
4774 b_conv = ChannelUpdate_clone(&b_conv);
4776 LDKChannelUpdate c_conv;
4777 c_conv.inner = (void*)(c & (~1));
4778 c_conv.is_owned = (c & 1) || (c == 0);
4779 c_conv = ChannelUpdate_clone(&c_conv);
4781 return (uint64_t)ret;
4783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4784 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4785 LDKChannelAnnouncement a_var = tuple->a;
4786 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4787 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4788 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4792 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4793 LDKChannelUpdate b_var = tuple->b;
4794 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4795 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4796 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4800 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4801 LDKChannelUpdate c_var = tuple->c;
4802 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4803 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4804 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4808 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4809 ret->datalen = (*env)->GetArrayLength(env, elems);
4810 if (ret->datalen == 0) {
4813 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4814 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4815 for (size_t i = 0; i < ret->datalen; i++) {
4816 int64_t arr_elem = java_elems[i];
4817 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4818 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4819 ret->data[i] = arr_elem_conv;
4821 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4823 return (uint64_t)ret;
4825 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4826 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4827 for (size_t i = 0; i < ret.datalen; i++) {
4828 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4833 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4834 ret->datalen = (*env)->GetArrayLength(env, elems);
4835 if (ret->datalen == 0) {
4838 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4839 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4840 for (size_t i = 0; i < ret->datalen; i++) {
4841 int64_t arr_elem = java_elems[i];
4842 LDKNodeAnnouncement arr_elem_conv;
4843 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4844 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4845 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4846 ret->data[i] = arr_elem_conv;
4848 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4850 return (uint64_t)ret;
4852 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4853 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4854 for (size_t i = 0; i < ret.datalen; i++) {
4855 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4860 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4863 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4864 CHECK(val->result_ok);
4865 return *val->contents.result;
4867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4868 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4869 CHECK(!val->result_ok);
4870 LDKLightningError err_var = (*val->contents.err);
4871 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4872 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4873 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4877 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4880 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4881 CHECK(val->result_ok);
4882 LDKCVec_u8Z res_var = (*val->contents.result);
4883 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4884 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4888 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4889 CHECK(!val->result_ok);
4890 LDKPeerHandleError err_var = (*val->contents.err);
4891 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4892 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4893 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4897 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4900 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4901 CHECK(val->result_ok);
4902 return *val->contents.result;
4904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4905 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4906 CHECK(!val->result_ok);
4907 LDKPeerHandleError err_var = (*val->contents.err);
4908 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4909 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4910 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4914 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4917 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4918 CHECK(val->result_ok);
4919 return *val->contents.result;
4921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4922 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4923 CHECK(!val->result_ok);
4924 LDKPeerHandleError err_var = (*val->contents.err);
4925 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4926 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4927 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4931 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4934 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4935 CHECK(val->result_ok);
4936 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4937 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4938 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4939 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4943 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4944 CHECK(!val->result_ok);
4945 LDKDecodeError err_var = (*val->contents.err);
4946 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4947 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4948 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4952 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4955 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4956 CHECK(val->result_ok);
4957 LDKChannelInfo res_var = (*val->contents.result);
4958 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4959 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4960 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4964 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4965 CHECK(!val->result_ok);
4966 LDKDecodeError err_var = (*val->contents.err);
4967 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4968 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4969 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4973 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4976 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4977 CHECK(val->result_ok);
4978 LDKRoutingFees res_var = (*val->contents.result);
4979 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4980 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4981 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4985 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4986 CHECK(!val->result_ok);
4987 LDKDecodeError err_var = (*val->contents.err);
4988 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4989 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4990 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4994 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4997 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4998 CHECK(val->result_ok);
4999 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5000 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5001 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5002 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5006 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5007 CHECK(!val->result_ok);
5008 LDKDecodeError err_var = (*val->contents.err);
5009 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5010 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5011 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5015 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5016 ret->datalen = (*env)->GetArrayLength(env, elems);
5017 if (ret->datalen == 0) {
5020 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5021 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5022 for (size_t i = 0; i < ret->datalen; i++) {
5023 ret->data[i] = java_elems[i];
5025 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5027 return (uint64_t)ret;
5029 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5030 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5031 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5035 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5038 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5039 CHECK(val->result_ok);
5040 LDKNodeInfo res_var = (*val->contents.result);
5041 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5042 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5043 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5047 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5048 CHECK(!val->result_ok);
5049 LDKDecodeError err_var = (*val->contents.err);
5050 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5051 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5052 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5056 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5059 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5060 CHECK(val->result_ok);
5061 LDKNetworkGraph res_var = (*val->contents.result);
5062 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5063 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5064 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5068 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5069 CHECK(!val->result_ok);
5070 LDKDecodeError err_var = (*val->contents.err);
5071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5073 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5077 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5080 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5081 CHECK(val->result_ok);
5082 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5085 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5086 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5087 CHECK(!val->result_ok);
5088 return *val->contents.err;
5090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5091 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5094 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5095 CHECK(val->result_ok);
5096 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5097 *res_conv = (*val->contents.result);
5098 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5099 return (uint64_t)res_conv;
5101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5102 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5103 CHECK(!val->result_ok);
5104 LDKDecodeError err_var = (*val->contents.err);
5105 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5106 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5107 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5111 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5114 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5115 CHECK(val->result_ok);
5116 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5120 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5121 CHECK(!val->result_ok);
5122 LDKDecodeError err_var = (*val->contents.err);
5123 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5124 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5125 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5129 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5130 ret->datalen = (*env)->GetArrayLength(env, elems);
5131 if (ret->datalen == 0) {
5134 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5135 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5136 for (size_t i = 0; i < ret->datalen; i++) {
5137 int64_t arr_elem = java_elems[i];
5138 LDKUpdateAddHTLC arr_elem_conv;
5139 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5140 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5141 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5142 ret->data[i] = arr_elem_conv;
5144 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5146 return (uint64_t)ret;
5148 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5149 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5150 for (size_t i = 0; i < ret.datalen; i++) {
5151 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5156 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5157 ret->datalen = (*env)->GetArrayLength(env, elems);
5158 if (ret->datalen == 0) {
5161 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5162 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5163 for (size_t i = 0; i < ret->datalen; i++) {
5164 int64_t arr_elem = java_elems[i];
5165 LDKUpdateFulfillHTLC arr_elem_conv;
5166 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5167 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5168 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5169 ret->data[i] = arr_elem_conv;
5171 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5173 return (uint64_t)ret;
5175 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5176 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5177 for (size_t i = 0; i < ret.datalen; i++) {
5178 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5183 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5184 ret->datalen = (*env)->GetArrayLength(env, elems);
5185 if (ret->datalen == 0) {
5188 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5189 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5190 for (size_t i = 0; i < ret->datalen; i++) {
5191 int64_t arr_elem = java_elems[i];
5192 LDKUpdateFailHTLC arr_elem_conv;
5193 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5194 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5195 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5196 ret->data[i] = arr_elem_conv;
5198 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5200 return (uint64_t)ret;
5202 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5203 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5204 for (size_t i = 0; i < ret.datalen; i++) {
5205 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5210 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5211 ret->datalen = (*env)->GetArrayLength(env, elems);
5212 if (ret->datalen == 0) {
5215 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5216 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5217 for (size_t i = 0; i < ret->datalen; i++) {
5218 int64_t arr_elem = java_elems[i];
5219 LDKUpdateFailMalformedHTLC arr_elem_conv;
5220 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5221 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5222 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5223 ret->data[i] = arr_elem_conv;
5225 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5227 return (uint64_t)ret;
5229 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5230 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5231 for (size_t i = 0; i < ret.datalen; i++) {
5232 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5237 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5240 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5241 CHECK(val->result_ok);
5242 LDKAcceptChannel res_var = (*val->contents.result);
5243 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5244 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5245 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5249 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5250 CHECK(!val->result_ok);
5251 LDKDecodeError err_var = (*val->contents.err);
5252 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5253 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5254 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5258 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5261 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5262 CHECK(val->result_ok);
5263 LDKAnnouncementSignatures res_var = (*val->contents.result);
5264 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5265 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5266 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5270 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5271 CHECK(!val->result_ok);
5272 LDKDecodeError err_var = (*val->contents.err);
5273 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5274 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5275 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5279 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5282 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5283 CHECK(val->result_ok);
5284 LDKChannelReestablish res_var = (*val->contents.result);
5285 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5286 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5287 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5291 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5292 CHECK(!val->result_ok);
5293 LDKDecodeError err_var = (*val->contents.err);
5294 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5295 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5296 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5300 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5303 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5304 CHECK(val->result_ok);
5305 LDKClosingSigned res_var = (*val->contents.result);
5306 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5307 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5308 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5312 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5313 CHECK(!val->result_ok);
5314 LDKDecodeError err_var = (*val->contents.err);
5315 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5316 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5317 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5321 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5324 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5325 CHECK(val->result_ok);
5326 LDKCommitmentSigned res_var = (*val->contents.result);
5327 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5328 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5329 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5333 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5334 CHECK(!val->result_ok);
5335 LDKDecodeError err_var = (*val->contents.err);
5336 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5337 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5338 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5342 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5345 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5346 CHECK(val->result_ok);
5347 LDKFundingCreated res_var = (*val->contents.result);
5348 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5349 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5350 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5354 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5355 CHECK(!val->result_ok);
5356 LDKDecodeError err_var = (*val->contents.err);
5357 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5358 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5359 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5363 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5366 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5367 CHECK(val->result_ok);
5368 LDKFundingSigned res_var = (*val->contents.result);
5369 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5370 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5371 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5375 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5376 CHECK(!val->result_ok);
5377 LDKDecodeError err_var = (*val->contents.err);
5378 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5379 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5380 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5384 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5387 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5388 CHECK(val->result_ok);
5389 LDKFundingLocked res_var = (*val->contents.result);
5390 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5391 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5392 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5396 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5397 CHECK(!val->result_ok);
5398 LDKDecodeError err_var = (*val->contents.err);
5399 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5400 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5401 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5405 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5408 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5409 CHECK(val->result_ok);
5410 LDKInit res_var = (*val->contents.result);
5411 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5412 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5413 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5417 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5418 CHECK(!val->result_ok);
5419 LDKDecodeError err_var = (*val->contents.err);
5420 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5421 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5422 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5426 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5429 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5430 CHECK(val->result_ok);
5431 LDKOpenChannel res_var = (*val->contents.result);
5432 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5433 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5434 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5438 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5439 CHECK(!val->result_ok);
5440 LDKDecodeError err_var = (*val->contents.err);
5441 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5442 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5443 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5447 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5450 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5451 CHECK(val->result_ok);
5452 LDKRevokeAndACK res_var = (*val->contents.result);
5453 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5454 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5455 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5459 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5460 CHECK(!val->result_ok);
5461 LDKDecodeError err_var = (*val->contents.err);
5462 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5463 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5464 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5468 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5471 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5472 CHECK(val->result_ok);
5473 LDKShutdown res_var = (*val->contents.result);
5474 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5475 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5476 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5480 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5481 CHECK(!val->result_ok);
5482 LDKDecodeError err_var = (*val->contents.err);
5483 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5484 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5485 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5489 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5492 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5493 CHECK(val->result_ok);
5494 LDKUpdateFailHTLC res_var = (*val->contents.result);
5495 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5496 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5497 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5501 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5502 CHECK(!val->result_ok);
5503 LDKDecodeError err_var = (*val->contents.err);
5504 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5505 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5506 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5510 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5513 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5514 CHECK(val->result_ok);
5515 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5516 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5517 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5518 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5522 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5523 CHECK(!val->result_ok);
5524 LDKDecodeError err_var = (*val->contents.err);
5525 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5526 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5527 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5531 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5534 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5535 CHECK(val->result_ok);
5536 LDKUpdateFee res_var = (*val->contents.result);
5537 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5538 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5539 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5543 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5544 CHECK(!val->result_ok);
5545 LDKDecodeError err_var = (*val->contents.err);
5546 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5547 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5548 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5552 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5555 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5556 CHECK(val->result_ok);
5557 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5558 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5559 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5560 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5564 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5565 CHECK(!val->result_ok);
5566 LDKDecodeError err_var = (*val->contents.err);
5567 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5568 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5569 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5573 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5576 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5577 CHECK(val->result_ok);
5578 LDKUpdateAddHTLC res_var = (*val->contents.result);
5579 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5580 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5581 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5585 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5586 CHECK(!val->result_ok);
5587 LDKDecodeError err_var = (*val->contents.err);
5588 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5589 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5590 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5594 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5597 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5598 CHECK(val->result_ok);
5599 LDKPing res_var = (*val->contents.result);
5600 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5601 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5602 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5606 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5607 CHECK(!val->result_ok);
5608 LDKDecodeError err_var = (*val->contents.err);
5609 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5610 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5611 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5615 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5618 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5619 CHECK(val->result_ok);
5620 LDKPong res_var = (*val->contents.result);
5621 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5622 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5623 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5627 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5628 CHECK(!val->result_ok);
5629 LDKDecodeError err_var = (*val->contents.err);
5630 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5631 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5632 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5636 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5639 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5640 CHECK(val->result_ok);
5641 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5642 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5643 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5644 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5648 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5649 CHECK(!val->result_ok);
5650 LDKDecodeError err_var = (*val->contents.err);
5651 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5652 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5653 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5657 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5660 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5661 CHECK(val->result_ok);
5662 LDKChannelAnnouncement res_var = (*val->contents.result);
5663 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5664 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5665 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5669 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5670 CHECK(!val->result_ok);
5671 LDKDecodeError err_var = (*val->contents.err);
5672 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5673 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5674 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5678 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5681 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5682 CHECK(val->result_ok);
5683 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5684 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5685 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5686 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5690 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5691 CHECK(!val->result_ok);
5692 LDKDecodeError err_var = (*val->contents.err);
5693 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5694 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5695 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5699 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5702 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5703 CHECK(val->result_ok);
5704 LDKChannelUpdate res_var = (*val->contents.result);
5705 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5706 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5707 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5711 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5712 CHECK(!val->result_ok);
5713 LDKDecodeError err_var = (*val->contents.err);
5714 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5715 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5716 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5720 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5723 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5724 CHECK(val->result_ok);
5725 LDKErrorMessage res_var = (*val->contents.result);
5726 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5727 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5728 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5732 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5733 CHECK(!val->result_ok);
5734 LDKDecodeError err_var = (*val->contents.err);
5735 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5736 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5737 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5741 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5744 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5745 CHECK(val->result_ok);
5746 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5747 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5748 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5749 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5753 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5754 CHECK(!val->result_ok);
5755 LDKDecodeError err_var = (*val->contents.err);
5756 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5757 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5758 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5762 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5765 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5766 CHECK(val->result_ok);
5767 LDKNodeAnnouncement res_var = (*val->contents.result);
5768 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5769 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5770 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5774 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5775 CHECK(!val->result_ok);
5776 LDKDecodeError err_var = (*val->contents.err);
5777 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5778 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5779 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5783 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5786 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5787 CHECK(val->result_ok);
5788 LDKQueryShortChannelIds res_var = (*val->contents.result);
5789 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5790 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5791 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5795 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5796 CHECK(!val->result_ok);
5797 LDKDecodeError err_var = (*val->contents.err);
5798 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5799 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5800 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5804 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5807 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5808 CHECK(val->result_ok);
5809 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5810 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5811 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5812 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5816 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5817 CHECK(!val->result_ok);
5818 LDKDecodeError err_var = (*val->contents.err);
5819 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5820 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5821 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5825 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5828 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5829 CHECK(val->result_ok);
5830 LDKQueryChannelRange res_var = (*val->contents.result);
5831 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5832 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5833 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5837 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5838 CHECK(!val->result_ok);
5839 LDKDecodeError err_var = (*val->contents.err);
5840 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5841 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5842 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5846 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5849 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5850 CHECK(val->result_ok);
5851 LDKReplyChannelRange res_var = (*val->contents.result);
5852 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5853 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5854 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5858 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5859 CHECK(!val->result_ok);
5860 LDKDecodeError err_var = (*val->contents.err);
5861 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5862 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5863 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5867 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5870 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5871 CHECK(val->result_ok);
5872 LDKGossipTimestampFilter res_var = (*val->contents.result);
5873 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5874 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5875 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5879 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5880 CHECK(!val->result_ok);
5881 LDKDecodeError err_var = (*val->contents.err);
5882 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5883 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5884 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5887 static jclass LDKSignOrCreationError_SignError_class = NULL;
5888 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5889 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5890 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5892 LDKSignOrCreationError_SignError_class =
5893 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5894 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5895 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5896 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5897 LDKSignOrCreationError_CreationError_class =
5898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
5899 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
5900 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
5901 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
5903 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5904 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5906 case LDKSignOrCreationError_SignError: {
5907 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
5909 case LDKSignOrCreationError_CreationError: {
5910 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
5911 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
5916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5917 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5920 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5921 CHECK(val->result_ok);
5922 LDKInvoice res_var = (*val->contents.result);
5923 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5924 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5925 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5929 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5930 CHECK(!val->result_ok);
5931 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5934 typedef struct LDKMessageSendEventsProvider_JCalls {
5935 atomic_size_t refcnt;
5938 jmethodID get_and_clear_pending_msg_events_meth;
5939 } LDKMessageSendEventsProvider_JCalls;
5940 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5941 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5942 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5944 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5945 if (get_jenv_res == JNI_EDETACHED) {
5946 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5948 DO_ASSERT(get_jenv_res == JNI_OK);
5950 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5951 if (get_jenv_res == JNI_EDETACHED) {
5952 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5957 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5958 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5960 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5961 if (get_jenv_res == JNI_EDETACHED) {
5962 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5964 DO_ASSERT(get_jenv_res == JNI_OK);
5966 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5968 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
5969 LDKCVec_MessageSendEventZ ret_constr;
5970 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5971 if (ret_constr.datalen > 0)
5972 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5974 ret_constr.data = NULL;
5975 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5976 for (size_t s = 0; s < ret_constr.datalen; s++) {
5977 int64_t ret_conv_18 = ret_vals[s];
5978 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5979 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5980 ret_constr.data[s] = ret_conv_18_conv;
5982 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5983 if (get_jenv_res == JNI_EDETACHED) {
5984 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5988 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
5989 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5990 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5991 return (void*) this_arg;
5993 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
5994 jclass c = (*env)->GetObjectClass(env, o);
5996 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5997 atomic_init(&calls->refcnt, 1);
5998 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5999 calls->o = (*env)->NewWeakGlobalRef(env, o);
6000 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6001 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6003 LDKMessageSendEventsProvider ret = {
6004 .this_arg = (void*) calls,
6005 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6006 .free = LDKMessageSendEventsProvider_JCalls_free,
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6011 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6012 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6013 return (uint64_t)res_ptr;
6015 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6016 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6017 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6018 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6019 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6020 for (size_t s = 0; s < ret_var.datalen; s++) {
6021 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6022 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6023 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6024 ret_arr_ptr[s] = ret_conv_18_ref;
6026 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6031 typedef struct LDKEventHandler_JCalls {
6032 atomic_size_t refcnt;
6035 jmethodID handle_event_meth;
6036 } LDKEventHandler_JCalls;
6037 static void LDKEventHandler_JCalls_free(void* this_arg) {
6038 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6039 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6041 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6042 if (get_jenv_res == JNI_EDETACHED) {
6043 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6045 DO_ASSERT(get_jenv_res == JNI_OK);
6047 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6048 if (get_jenv_res == JNI_EDETACHED) {
6049 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6054 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6055 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6057 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6058 if (get_jenv_res == JNI_EDETACHED) {
6059 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6061 DO_ASSERT(get_jenv_res == JNI_OK);
6063 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6064 *event_copy = event;
6065 uint64_t event_ref = (uint64_t)event_copy;
6066 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6068 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6069 if (get_jenv_res == JNI_EDETACHED) {
6070 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6073 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6074 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6075 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6076 return (void*) this_arg;
6078 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6079 jclass c = (*env)->GetObjectClass(env, o);
6081 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6082 atomic_init(&calls->refcnt, 1);
6083 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6084 calls->o = (*env)->NewWeakGlobalRef(env, o);
6085 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6086 CHECK(calls->handle_event_meth != NULL);
6088 LDKEventHandler ret = {
6089 .this_arg = (void*) calls,
6090 .handle_event = handle_event_LDKEventHandler_jcall,
6091 .free = LDKEventHandler_JCalls_free,
6095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6096 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6097 *res_ptr = LDKEventHandler_init(env, clz, o);
6098 return (uint64_t)res_ptr;
6100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6101 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6102 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6103 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6106 typedef struct LDKEventsProvider_JCalls {
6107 atomic_size_t refcnt;
6110 jmethodID process_pending_events_meth;
6111 } LDKEventsProvider_JCalls;
6112 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6113 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6114 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6116 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6117 if (get_jenv_res == JNI_EDETACHED) {
6118 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6120 DO_ASSERT(get_jenv_res == JNI_OK);
6122 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6123 if (get_jenv_res == JNI_EDETACHED) {
6124 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6129 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6130 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6132 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6133 if (get_jenv_res == JNI_EDETACHED) {
6134 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6136 DO_ASSERT(get_jenv_res == JNI_OK);
6138 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6142 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6143 if (get_jenv_res == JNI_EDETACHED) {
6144 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6147 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6148 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6149 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6150 return (void*) this_arg;
6152 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6153 jclass c = (*env)->GetObjectClass(env, o);
6155 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6156 atomic_init(&calls->refcnt, 1);
6157 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6158 calls->o = (*env)->NewWeakGlobalRef(env, o);
6159 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6160 CHECK(calls->process_pending_events_meth != NULL);
6162 LDKEventsProvider ret = {
6163 .this_arg = (void*) calls,
6164 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6165 .free = LDKEventsProvider_JCalls_free,
6169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6170 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6171 *res_ptr = LDKEventsProvider_init(env, clz, o);
6172 return (uint64_t)res_ptr;
6174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6175 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6176 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6177 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6179 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6181 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6184 typedef struct LDKAccess_JCalls {
6185 atomic_size_t refcnt;
6188 jmethodID get_utxo_meth;
6190 static void LDKAccess_JCalls_free(void* this_arg) {
6191 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6192 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6194 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6195 if (get_jenv_res == JNI_EDETACHED) {
6196 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6198 DO_ASSERT(get_jenv_res == JNI_OK);
6200 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6201 if (get_jenv_res == JNI_EDETACHED) {
6202 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6207 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6208 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6211 if (get_jenv_res == JNI_EDETACHED) {
6212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6214 DO_ASSERT(get_jenv_res == JNI_OK);
6216 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6217 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6218 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6220 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6221 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6222 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6223 if (get_jenv_res == JNI_EDETACHED) {
6224 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6228 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6229 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6230 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6231 return (void*) this_arg;
6233 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6234 jclass c = (*env)->GetObjectClass(env, o);
6236 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6237 atomic_init(&calls->refcnt, 1);
6238 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6239 calls->o = (*env)->NewWeakGlobalRef(env, o);
6240 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6241 CHECK(calls->get_utxo_meth != NULL);
6244 .this_arg = (void*) calls,
6245 .get_utxo = get_utxo_LDKAccess_jcall,
6246 .free = LDKAccess_JCalls_free,
6250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6251 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6252 *res_ptr = LDKAccess_init(env, clz, o);
6253 return (uint64_t)res_ptr;
6255 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) {
6256 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6257 unsigned char genesis_hash_arr[32];
6258 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6259 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6260 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6261 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6262 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6263 return (uint64_t)ret_conv;
6266 typedef struct LDKListen_JCalls {
6267 atomic_size_t refcnt;
6270 jmethodID block_connected_meth;
6271 jmethodID block_disconnected_meth;
6273 static void LDKListen_JCalls_free(void* this_arg) {
6274 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6275 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6277 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6278 if (get_jenv_res == JNI_EDETACHED) {
6279 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6281 DO_ASSERT(get_jenv_res == JNI_OK);
6283 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6284 if (get_jenv_res == JNI_EDETACHED) {
6285 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6290 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6291 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6293 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6294 if (get_jenv_res == JNI_EDETACHED) {
6295 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6297 DO_ASSERT(get_jenv_res == JNI_OK);
6299 LDKu8slice block_var = block;
6300 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6301 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6302 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6304 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6305 if (get_jenv_res == JNI_EDETACHED) {
6306 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6309 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6310 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6312 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6313 if (get_jenv_res == JNI_EDETACHED) {
6314 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6316 DO_ASSERT(get_jenv_res == JNI_OK);
6318 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6319 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6320 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6322 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6323 if (get_jenv_res == JNI_EDETACHED) {
6324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6327 static void* LDKListen_JCalls_clone(const void* this_arg) {
6328 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6329 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6330 return (void*) this_arg;
6332 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6333 jclass c = (*env)->GetObjectClass(env, o);
6335 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6336 atomic_init(&calls->refcnt, 1);
6337 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6338 calls->o = (*env)->NewWeakGlobalRef(env, o);
6339 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6340 CHECK(calls->block_connected_meth != NULL);
6341 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6342 CHECK(calls->block_disconnected_meth != NULL);
6345 .this_arg = (void*) calls,
6346 .block_connected = block_connected_LDKListen_jcall,
6347 .block_disconnected = block_disconnected_LDKListen_jcall,
6348 .free = LDKListen_JCalls_free,
6352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6353 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6354 *res_ptr = LDKListen_init(env, clz, o);
6355 return (uint64_t)res_ptr;
6357 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) {
6358 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6359 LDKu8slice block_ref;
6360 block_ref.datalen = (*env)->GetArrayLength(env, block);
6361 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6362 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6363 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6366 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) {
6367 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6368 unsigned char header_arr[80];
6369 CHECK((*env)->GetArrayLength(env, header) == 80);
6370 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6371 unsigned char (*header_ref)[80] = &header_arr;
6372 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6375 typedef struct LDKConfirm_JCalls {
6376 atomic_size_t refcnt;
6379 jmethodID transactions_confirmed_meth;
6380 jmethodID transaction_unconfirmed_meth;
6381 jmethodID best_block_updated_meth;
6382 jmethodID get_relevant_txids_meth;
6383 } LDKConfirm_JCalls;
6384 static void LDKConfirm_JCalls_free(void* this_arg) {
6385 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6386 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6389 if (get_jenv_res == JNI_EDETACHED) {
6390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6392 DO_ASSERT(get_jenv_res == JNI_OK);
6394 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6395 if (get_jenv_res == JNI_EDETACHED) {
6396 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6401 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6402 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6405 if (get_jenv_res == JNI_EDETACHED) {
6406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6408 DO_ASSERT(get_jenv_res == JNI_OK);
6410 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6411 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6412 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6413 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6414 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6415 for (size_t y = 0; y < txdata_var.datalen; y++) {
6416 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6417 *txdata_conv_24_ref = txdata_var.data[y];
6418 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6420 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6421 FREE(txdata_var.data);
6422 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6424 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6425 if (get_jenv_res == JNI_EDETACHED) {
6426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6429 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6430 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6432 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6433 if (get_jenv_res == JNI_EDETACHED) {
6434 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6436 DO_ASSERT(get_jenv_res == JNI_OK);
6438 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6439 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6440 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6442 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6443 if (get_jenv_res == JNI_EDETACHED) {
6444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6447 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6448 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6450 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6451 if (get_jenv_res == JNI_EDETACHED) {
6452 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6454 DO_ASSERT(get_jenv_res == JNI_OK);
6456 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6457 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6458 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6460 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6461 if (get_jenv_res == JNI_EDETACHED) {
6462 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6465 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6466 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6468 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6469 if (get_jenv_res == JNI_EDETACHED) {
6470 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6472 DO_ASSERT(get_jenv_res == JNI_OK);
6474 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6476 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6477 LDKCVec_TxidZ ret_constr;
6478 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6479 if (ret_constr.datalen > 0)
6480 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6482 ret_constr.data = NULL;
6483 for (size_t i = 0; i < ret_constr.datalen; i++) {
6484 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6485 LDKThirtyTwoBytes ret_conv_8_ref;
6486 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6487 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6488 ret_constr.data[i] = ret_conv_8_ref;
6490 if (get_jenv_res == JNI_EDETACHED) {
6491 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6495 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6496 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6497 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6498 return (void*) this_arg;
6500 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6501 jclass c = (*env)->GetObjectClass(env, o);
6503 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6504 atomic_init(&calls->refcnt, 1);
6505 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6506 calls->o = (*env)->NewWeakGlobalRef(env, o);
6507 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6508 CHECK(calls->transactions_confirmed_meth != NULL);
6509 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6510 CHECK(calls->transaction_unconfirmed_meth != NULL);
6511 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6512 CHECK(calls->best_block_updated_meth != NULL);
6513 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6514 CHECK(calls->get_relevant_txids_meth != NULL);
6517 .this_arg = (void*) calls,
6518 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6519 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6520 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6521 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6522 .free = LDKConfirm_JCalls_free,
6526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6527 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6528 *res_ptr = LDKConfirm_init(env, clz, o);
6529 return (uint64_t)res_ptr;
6531 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) {
6532 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6533 unsigned char header_arr[80];
6534 CHECK((*env)->GetArrayLength(env, header) == 80);
6535 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6536 unsigned char (*header_ref)[80] = &header_arr;
6537 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6538 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6539 if (txdata_constr.datalen > 0)
6540 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6542 txdata_constr.data = NULL;
6543 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6544 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6545 int64_t txdata_conv_24 = txdata_vals[y];
6546 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6547 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6548 txdata_constr.data[y] = txdata_conv_24_conv;
6550 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6551 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6555 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6556 unsigned char txid_arr[32];
6557 CHECK((*env)->GetArrayLength(env, txid) == 32);
6558 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6559 unsigned char (*txid_ref)[32] = &txid_arr;
6560 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6563 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) {
6564 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6565 unsigned char header_arr[80];
6566 CHECK((*env)->GetArrayLength(env, header) == 80);
6567 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6568 unsigned char (*header_ref)[80] = &header_arr;
6569 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6572 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6573 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6574 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6575 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6577 for (size_t i = 0; i < ret_var.datalen; i++) {
6578 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6579 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6580 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6586 typedef struct LDKFilter_JCalls {
6587 atomic_size_t refcnt;
6590 jmethodID register_tx_meth;
6591 jmethodID register_output_meth;
6593 static void LDKFilter_JCalls_free(void* this_arg) {
6594 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6595 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6597 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6598 if (get_jenv_res == JNI_EDETACHED) {
6599 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6601 DO_ASSERT(get_jenv_res == JNI_OK);
6603 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6604 if (get_jenv_res == JNI_EDETACHED) {
6605 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6610 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6611 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6613 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6614 if (get_jenv_res == JNI_EDETACHED) {
6615 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6617 DO_ASSERT(get_jenv_res == JNI_OK);
6619 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6620 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6621 LDKu8slice script_pubkey_var = script_pubkey;
6622 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6623 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6624 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6626 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6627 if (get_jenv_res == JNI_EDETACHED) {
6628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6631 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6632 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6634 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6635 if (get_jenv_res == JNI_EDETACHED) {
6636 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6638 DO_ASSERT(get_jenv_res == JNI_OK);
6640 LDKWatchedOutput output_var = output;
6641 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6642 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6643 uint64_t output_ref = (uint64_t)output_var.inner;
6644 if (output_var.is_owned) {
6647 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6649 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6650 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6651 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6652 if (get_jenv_res == JNI_EDETACHED) {
6653 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6657 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6658 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6659 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6660 return (void*) this_arg;
6662 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6663 jclass c = (*env)->GetObjectClass(env, o);
6665 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6666 atomic_init(&calls->refcnt, 1);
6667 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6668 calls->o = (*env)->NewWeakGlobalRef(env, o);
6669 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6670 CHECK(calls->register_tx_meth != NULL);
6671 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6672 CHECK(calls->register_output_meth != NULL);
6675 .this_arg = (void*) calls,
6676 .register_tx = register_tx_LDKFilter_jcall,
6677 .register_output = register_output_LDKFilter_jcall,
6678 .free = LDKFilter_JCalls_free,
6682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6683 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6684 *res_ptr = LDKFilter_init(env, clz, o);
6685 return (uint64_t)res_ptr;
6687 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) {
6688 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6689 unsigned char txid_arr[32];
6690 CHECK((*env)->GetArrayLength(env, txid) == 32);
6691 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6692 unsigned char (*txid_ref)[32] = &txid_arr;
6693 LDKu8slice script_pubkey_ref;
6694 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6695 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6696 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6697 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6701 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6702 LDKWatchedOutput output_conv;
6703 output_conv.inner = (void*)(output & (~1));
6704 output_conv.is_owned = (output & 1) || (output == 0);
6705 output_conv = WatchedOutput_clone(&output_conv);
6706 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6707 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6708 uint64_t ret_ref = (uint64_t)ret_copy;
6712 typedef struct LDKPersist_JCalls {
6713 atomic_size_t refcnt;
6716 jmethodID persist_new_channel_meth;
6717 jmethodID update_persisted_channel_meth;
6718 } LDKPersist_JCalls;
6719 static void LDKPersist_JCalls_free(void* this_arg) {
6720 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6721 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6730 if (get_jenv_res == JNI_EDETACHED) {
6731 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6736 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6737 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6739 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6740 if (get_jenv_res == JNI_EDETACHED) {
6741 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6743 DO_ASSERT(get_jenv_res == JNI_OK);
6745 LDKOutPoint id_var = id;
6746 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6747 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6748 uint64_t id_ref = (uint64_t)id_var.inner;
6749 if (id_var.is_owned) {
6752 LDKChannelMonitor data_var = *data;
6753 data_var = ChannelMonitor_clone(data);
6754 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6755 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6756 uint64_t data_ref = (uint64_t)data_var.inner;
6757 if (data_var.is_owned) {
6760 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6762 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6763 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6764 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6765 if (get_jenv_res == JNI_EDETACHED) {
6766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6770 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6771 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6773 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6774 if (get_jenv_res == JNI_EDETACHED) {
6775 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6777 DO_ASSERT(get_jenv_res == JNI_OK);
6779 LDKOutPoint id_var = id;
6780 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6781 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6782 uint64_t id_ref = (uint64_t)id_var.inner;
6783 if (id_var.is_owned) {
6786 LDKChannelMonitorUpdate update_var = *update;
6787 update_var = ChannelMonitorUpdate_clone(update);
6788 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6789 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6790 uint64_t update_ref = (uint64_t)update_var.inner;
6791 if (update_var.is_owned) {
6794 LDKChannelMonitor data_var = *data;
6795 data_var = ChannelMonitor_clone(data);
6796 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6797 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6798 uint64_t data_ref = (uint64_t)data_var.inner;
6799 if (data_var.is_owned) {
6802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6804 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6805 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6806 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6807 if (get_jenv_res == JNI_EDETACHED) {
6808 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6812 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6813 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6814 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6815 return (void*) this_arg;
6817 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6818 jclass c = (*env)->GetObjectClass(env, o);
6820 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6821 atomic_init(&calls->refcnt, 1);
6822 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6823 calls->o = (*env)->NewWeakGlobalRef(env, o);
6824 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6825 CHECK(calls->persist_new_channel_meth != NULL);
6826 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6827 CHECK(calls->update_persisted_channel_meth != NULL);
6830 .this_arg = (void*) calls,
6831 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6832 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6833 .free = LDKPersist_JCalls_free,
6837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6838 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6839 *res_ptr = LDKPersist_init(env, clz, o);
6840 return (uint64_t)res_ptr;
6842 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) {
6843 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6844 LDKOutPoint id_conv;
6845 id_conv.inner = (void*)(id & (~1));
6846 id_conv.is_owned = (id & 1) || (id == 0);
6847 id_conv = OutPoint_clone(&id_conv);
6848 LDKChannelMonitor data_conv;
6849 data_conv.inner = (void*)(data & (~1));
6850 data_conv.is_owned = false;
6851 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6852 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6853 return (uint64_t)ret_conv;
6856 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) {
6857 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6858 LDKOutPoint id_conv;
6859 id_conv.inner = (void*)(id & (~1));
6860 id_conv.is_owned = (id & 1) || (id == 0);
6861 id_conv = OutPoint_clone(&id_conv);
6862 LDKChannelMonitorUpdate update_conv;
6863 update_conv.inner = (void*)(update & (~1));
6864 update_conv.is_owned = false;
6865 LDKChannelMonitor data_conv;
6866 data_conv.inner = (void*)(data & (~1));
6867 data_conv.is_owned = false;
6868 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6869 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6870 return (uint64_t)ret_conv;
6873 typedef struct LDKChannelMessageHandler_JCalls {
6874 atomic_size_t refcnt;
6877 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6878 jmethodID handle_open_channel_meth;
6879 jmethodID handle_accept_channel_meth;
6880 jmethodID handle_funding_created_meth;
6881 jmethodID handle_funding_signed_meth;
6882 jmethodID handle_funding_locked_meth;
6883 jmethodID handle_shutdown_meth;
6884 jmethodID handle_closing_signed_meth;
6885 jmethodID handle_update_add_htlc_meth;
6886 jmethodID handle_update_fulfill_htlc_meth;
6887 jmethodID handle_update_fail_htlc_meth;
6888 jmethodID handle_update_fail_malformed_htlc_meth;
6889 jmethodID handle_commitment_signed_meth;
6890 jmethodID handle_revoke_and_ack_meth;
6891 jmethodID handle_update_fee_meth;
6892 jmethodID handle_announcement_signatures_meth;
6893 jmethodID peer_disconnected_meth;
6894 jmethodID peer_connected_meth;
6895 jmethodID handle_channel_reestablish_meth;
6896 jmethodID handle_channel_update_meth;
6897 jmethodID handle_error_meth;
6898 } LDKChannelMessageHandler_JCalls;
6899 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6900 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6901 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6903 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6904 if (get_jenv_res == JNI_EDETACHED) {
6905 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6907 DO_ASSERT(get_jenv_res == JNI_OK);
6909 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6910 if (get_jenv_res == JNI_EDETACHED) {
6911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6916 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6917 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6920 if (get_jenv_res == JNI_EDETACHED) {
6921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6923 DO_ASSERT(get_jenv_res == JNI_OK);
6925 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6926 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6927 LDKInitFeatures their_features_var = their_features;
6928 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6929 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6930 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6931 if (their_features_var.is_owned) {
6932 their_features_ref |= 1;
6934 LDKOpenChannel msg_var = *msg;
6935 msg_var = OpenChannel_clone(msg);
6936 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6937 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6938 uint64_t msg_ref = (uint64_t)msg_var.inner;
6939 if (msg_var.is_owned) {
6942 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6944 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6945 if (get_jenv_res == JNI_EDETACHED) {
6946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6949 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6950 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6952 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6953 if (get_jenv_res == JNI_EDETACHED) {
6954 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6956 DO_ASSERT(get_jenv_res == JNI_OK);
6958 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6959 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6960 LDKInitFeatures their_features_var = their_features;
6961 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6962 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6963 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6964 if (their_features_var.is_owned) {
6965 their_features_ref |= 1;
6967 LDKAcceptChannel msg_var = *msg;
6968 msg_var = AcceptChannel_clone(msg);
6969 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6970 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6971 uint64_t msg_ref = (uint64_t)msg_var.inner;
6972 if (msg_var.is_owned) {
6975 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6977 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6978 if (get_jenv_res == JNI_EDETACHED) {
6979 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6982 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6983 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6985 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6986 if (get_jenv_res == JNI_EDETACHED) {
6987 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6989 DO_ASSERT(get_jenv_res == JNI_OK);
6991 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6992 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6993 LDKFundingCreated msg_var = *msg;
6994 msg_var = FundingCreated_clone(msg);
6995 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6996 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6997 uint64_t msg_ref = (uint64_t)msg_var.inner;
6998 if (msg_var.is_owned) {
7001 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7003 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7004 if (get_jenv_res == JNI_EDETACHED) {
7005 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7008 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7009 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7011 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7012 if (get_jenv_res == JNI_EDETACHED) {
7013 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7015 DO_ASSERT(get_jenv_res == JNI_OK);
7017 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7018 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7019 LDKFundingSigned msg_var = *msg;
7020 msg_var = FundingSigned_clone(msg);
7021 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7022 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7023 uint64_t msg_ref = (uint64_t)msg_var.inner;
7024 if (msg_var.is_owned) {
7027 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7029 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7030 if (get_jenv_res == JNI_EDETACHED) {
7031 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7034 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7035 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7037 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7038 if (get_jenv_res == JNI_EDETACHED) {
7039 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7041 DO_ASSERT(get_jenv_res == JNI_OK);
7043 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7044 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7045 LDKFundingLocked msg_var = *msg;
7046 msg_var = FundingLocked_clone(msg);
7047 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7048 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7049 uint64_t msg_ref = (uint64_t)msg_var.inner;
7050 if (msg_var.is_owned) {
7053 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7055 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7056 if (get_jenv_res == JNI_EDETACHED) {
7057 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7060 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7061 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7063 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7064 if (get_jenv_res == JNI_EDETACHED) {
7065 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7067 DO_ASSERT(get_jenv_res == JNI_OK);
7069 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7070 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7071 LDKInitFeatures their_features_var = *their_features;
7072 their_features_var = InitFeatures_clone(their_features);
7073 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7074 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7075 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7076 if (their_features_var.is_owned) {
7077 their_features_ref |= 1;
7079 LDKShutdown msg_var = *msg;
7080 msg_var = Shutdown_clone(msg);
7081 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7082 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7083 uint64_t msg_ref = (uint64_t)msg_var.inner;
7084 if (msg_var.is_owned) {
7087 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7089 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7090 if (get_jenv_res == JNI_EDETACHED) {
7091 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7094 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7095 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7098 if (get_jenv_res == JNI_EDETACHED) {
7099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7101 DO_ASSERT(get_jenv_res == JNI_OK);
7103 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7104 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7105 LDKClosingSigned msg_var = *msg;
7106 msg_var = ClosingSigned_clone(msg);
7107 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7108 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7109 uint64_t msg_ref = (uint64_t)msg_var.inner;
7110 if (msg_var.is_owned) {
7113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7115 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7116 if (get_jenv_res == JNI_EDETACHED) {
7117 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7120 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7121 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7123 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7124 if (get_jenv_res == JNI_EDETACHED) {
7125 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7127 DO_ASSERT(get_jenv_res == JNI_OK);
7129 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7130 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7131 LDKUpdateAddHTLC msg_var = *msg;
7132 msg_var = UpdateAddHTLC_clone(msg);
7133 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7134 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7135 uint64_t msg_ref = (uint64_t)msg_var.inner;
7136 if (msg_var.is_owned) {
7139 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7141 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7142 if (get_jenv_res == JNI_EDETACHED) {
7143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7146 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7147 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7149 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7150 if (get_jenv_res == JNI_EDETACHED) {
7151 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7153 DO_ASSERT(get_jenv_res == JNI_OK);
7155 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7156 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7157 LDKUpdateFulfillHTLC msg_var = *msg;
7158 msg_var = UpdateFulfillHTLC_clone(msg);
7159 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7160 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7161 uint64_t msg_ref = (uint64_t)msg_var.inner;
7162 if (msg_var.is_owned) {
7165 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7167 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7168 if (get_jenv_res == JNI_EDETACHED) {
7169 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7172 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7173 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7175 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7176 if (get_jenv_res == JNI_EDETACHED) {
7177 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7179 DO_ASSERT(get_jenv_res == JNI_OK);
7181 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7182 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7183 LDKUpdateFailHTLC msg_var = *msg;
7184 msg_var = UpdateFailHTLC_clone(msg);
7185 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7186 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7187 uint64_t msg_ref = (uint64_t)msg_var.inner;
7188 if (msg_var.is_owned) {
7191 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7193 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7194 if (get_jenv_res == JNI_EDETACHED) {
7195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7198 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7199 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7201 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7202 if (get_jenv_res == JNI_EDETACHED) {
7203 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7205 DO_ASSERT(get_jenv_res == JNI_OK);
7207 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7208 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7209 LDKUpdateFailMalformedHTLC msg_var = *msg;
7210 msg_var = UpdateFailMalformedHTLC_clone(msg);
7211 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7212 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7213 uint64_t msg_ref = (uint64_t)msg_var.inner;
7214 if (msg_var.is_owned) {
7217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7219 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7220 if (get_jenv_res == JNI_EDETACHED) {
7221 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7224 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7225 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7227 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7228 if (get_jenv_res == JNI_EDETACHED) {
7229 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7231 DO_ASSERT(get_jenv_res == JNI_OK);
7233 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7234 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7235 LDKCommitmentSigned msg_var = *msg;
7236 msg_var = CommitmentSigned_clone(msg);
7237 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7238 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7239 uint64_t msg_ref = (uint64_t)msg_var.inner;
7240 if (msg_var.is_owned) {
7243 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7245 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7246 if (get_jenv_res == JNI_EDETACHED) {
7247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7250 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7251 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7253 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7254 if (get_jenv_res == JNI_EDETACHED) {
7255 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7257 DO_ASSERT(get_jenv_res == JNI_OK);
7259 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7260 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7261 LDKRevokeAndACK msg_var = *msg;
7262 msg_var = RevokeAndACK_clone(msg);
7263 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7264 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7265 uint64_t msg_ref = (uint64_t)msg_var.inner;
7266 if (msg_var.is_owned) {
7269 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7271 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7272 if (get_jenv_res == JNI_EDETACHED) {
7273 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7276 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7277 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7279 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7280 if (get_jenv_res == JNI_EDETACHED) {
7281 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7283 DO_ASSERT(get_jenv_res == JNI_OK);
7285 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7286 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7287 LDKUpdateFee msg_var = *msg;
7288 msg_var = UpdateFee_clone(msg);
7289 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7290 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7291 uint64_t msg_ref = (uint64_t)msg_var.inner;
7292 if (msg_var.is_owned) {
7295 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7297 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7298 if (get_jenv_res == JNI_EDETACHED) {
7299 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7302 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7303 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7305 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7306 if (get_jenv_res == JNI_EDETACHED) {
7307 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7309 DO_ASSERT(get_jenv_res == JNI_OK);
7311 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7312 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7313 LDKAnnouncementSignatures msg_var = *msg;
7314 msg_var = AnnouncementSignatures_clone(msg);
7315 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7316 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7317 uint64_t msg_ref = (uint64_t)msg_var.inner;
7318 if (msg_var.is_owned) {
7321 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7323 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7324 if (get_jenv_res == JNI_EDETACHED) {
7325 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7328 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7329 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7331 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7332 if (get_jenv_res == JNI_EDETACHED) {
7333 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7335 DO_ASSERT(get_jenv_res == JNI_OK);
7337 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7338 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7339 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7341 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7342 if (get_jenv_res == JNI_EDETACHED) {
7343 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7346 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7347 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7349 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7350 if (get_jenv_res == JNI_EDETACHED) {
7351 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7353 DO_ASSERT(get_jenv_res == JNI_OK);
7355 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7356 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7357 LDKInit msg_var = *msg;
7358 msg_var = Init_clone(msg);
7359 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7360 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7361 uint64_t msg_ref = (uint64_t)msg_var.inner;
7362 if (msg_var.is_owned) {
7365 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7367 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7368 if (get_jenv_res == JNI_EDETACHED) {
7369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7372 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7373 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7375 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7376 if (get_jenv_res == JNI_EDETACHED) {
7377 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7379 DO_ASSERT(get_jenv_res == JNI_OK);
7381 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7382 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7383 LDKChannelReestablish msg_var = *msg;
7384 msg_var = ChannelReestablish_clone(msg);
7385 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7386 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7387 uint64_t msg_ref = (uint64_t)msg_var.inner;
7388 if (msg_var.is_owned) {
7391 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7393 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7394 if (get_jenv_res == JNI_EDETACHED) {
7395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7398 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * 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 LDKChannelUpdate msg_var = *msg;
7410 msg_var = ChannelUpdate_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_channel_update_meth, their_node_id_arr, msg_ref);
7420 if (get_jenv_res == JNI_EDETACHED) {
7421 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7424 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7425 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7427 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7428 if (get_jenv_res == JNI_EDETACHED) {
7429 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7431 DO_ASSERT(get_jenv_res == JNI_OK);
7433 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7434 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7435 LDKErrorMessage msg_var = *msg;
7436 msg_var = ErrorMessage_clone(msg);
7437 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7438 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7439 uint64_t msg_ref = (uint64_t)msg_var.inner;
7440 if (msg_var.is_owned) {
7443 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7445 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7446 if (get_jenv_res == JNI_EDETACHED) {
7447 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7450 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7451 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7452 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7453 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7454 return (void*) this_arg;
7456 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7457 jclass c = (*env)->GetObjectClass(env, o);
7459 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7460 atomic_init(&calls->refcnt, 1);
7461 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7462 calls->o = (*env)->NewWeakGlobalRef(env, o);
7463 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7464 CHECK(calls->handle_open_channel_meth != NULL);
7465 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7466 CHECK(calls->handle_accept_channel_meth != NULL);
7467 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7468 CHECK(calls->handle_funding_created_meth != NULL);
7469 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7470 CHECK(calls->handle_funding_signed_meth != NULL);
7471 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7472 CHECK(calls->handle_funding_locked_meth != NULL);
7473 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7474 CHECK(calls->handle_shutdown_meth != NULL);
7475 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7476 CHECK(calls->handle_closing_signed_meth != NULL);
7477 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7478 CHECK(calls->handle_update_add_htlc_meth != NULL);
7479 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7480 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7481 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7482 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7483 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7484 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7485 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7486 CHECK(calls->handle_commitment_signed_meth != NULL);
7487 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7488 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7489 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7490 CHECK(calls->handle_update_fee_meth != NULL);
7491 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7492 CHECK(calls->handle_announcement_signatures_meth != NULL);
7493 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7494 CHECK(calls->peer_disconnected_meth != NULL);
7495 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7496 CHECK(calls->peer_connected_meth != NULL);
7497 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7498 CHECK(calls->handle_channel_reestablish_meth != NULL);
7499 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7500 CHECK(calls->handle_channel_update_meth != NULL);
7501 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7502 CHECK(calls->handle_error_meth != NULL);
7504 LDKChannelMessageHandler ret = {
7505 .this_arg = (void*) calls,
7506 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7507 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7508 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7509 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7510 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7511 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7512 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7513 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7514 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7515 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7516 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7517 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7518 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7519 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7520 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7521 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7522 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7523 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7524 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7525 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7526 .free = LDKChannelMessageHandler_JCalls_free,
7527 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7529 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7533 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7534 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7535 return (uint64_t)res_ptr;
7537 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) {
7538 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7539 LDKPublicKey their_node_id_ref;
7540 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7541 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7542 LDKInitFeatures their_features_conv;
7543 their_features_conv.inner = (void*)(their_features & (~1));
7544 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7545 their_features_conv = InitFeatures_clone(&their_features_conv);
7546 LDKOpenChannel msg_conv;
7547 msg_conv.inner = (void*)(msg & (~1));
7548 msg_conv.is_owned = false;
7549 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7552 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) {
7553 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7554 LDKPublicKey their_node_id_ref;
7555 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7556 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7557 LDKInitFeatures their_features_conv;
7558 their_features_conv.inner = (void*)(their_features & (~1));
7559 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7560 their_features_conv = InitFeatures_clone(&their_features_conv);
7561 LDKAcceptChannel msg_conv;
7562 msg_conv.inner = (void*)(msg & (~1));
7563 msg_conv.is_owned = false;
7564 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7567 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) {
7568 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7569 LDKPublicKey their_node_id_ref;
7570 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7571 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7572 LDKFundingCreated msg_conv;
7573 msg_conv.inner = (void*)(msg & (~1));
7574 msg_conv.is_owned = false;
7575 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7578 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) {
7579 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7580 LDKPublicKey their_node_id_ref;
7581 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7582 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7583 LDKFundingSigned msg_conv;
7584 msg_conv.inner = (void*)(msg & (~1));
7585 msg_conv.is_owned = false;
7586 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7589 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) {
7590 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7591 LDKPublicKey their_node_id_ref;
7592 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7593 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7594 LDKFundingLocked msg_conv;
7595 msg_conv.inner = (void*)(msg & (~1));
7596 msg_conv.is_owned = false;
7597 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7600 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) {
7601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7602 LDKPublicKey their_node_id_ref;
7603 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7604 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7605 LDKInitFeatures their_features_conv;
7606 their_features_conv.inner = (void*)(their_features & (~1));
7607 their_features_conv.is_owned = false;
7608 LDKShutdown msg_conv;
7609 msg_conv.inner = (void*)(msg & (~1));
7610 msg_conv.is_owned = false;
7611 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7614 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) {
7615 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7616 LDKPublicKey their_node_id_ref;
7617 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7618 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7619 LDKClosingSigned msg_conv;
7620 msg_conv.inner = (void*)(msg & (~1));
7621 msg_conv.is_owned = false;
7622 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7625 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) {
7626 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7627 LDKPublicKey their_node_id_ref;
7628 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7629 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7630 LDKUpdateAddHTLC msg_conv;
7631 msg_conv.inner = (void*)(msg & (~1));
7632 msg_conv.is_owned = false;
7633 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7636 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) {
7637 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7638 LDKPublicKey their_node_id_ref;
7639 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7640 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7641 LDKUpdateFulfillHTLC msg_conv;
7642 msg_conv.inner = (void*)(msg & (~1));
7643 msg_conv.is_owned = false;
7644 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7647 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) {
7648 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7649 LDKPublicKey their_node_id_ref;
7650 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7651 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7652 LDKUpdateFailHTLC msg_conv;
7653 msg_conv.inner = (void*)(msg & (~1));
7654 msg_conv.is_owned = false;
7655 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7658 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) {
7659 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7660 LDKPublicKey their_node_id_ref;
7661 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7662 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7663 LDKUpdateFailMalformedHTLC msg_conv;
7664 msg_conv.inner = (void*)(msg & (~1));
7665 msg_conv.is_owned = false;
7666 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7669 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) {
7670 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7671 LDKPublicKey their_node_id_ref;
7672 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7673 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7674 LDKCommitmentSigned msg_conv;
7675 msg_conv.inner = (void*)(msg & (~1));
7676 msg_conv.is_owned = false;
7677 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7680 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) {
7681 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7682 LDKPublicKey their_node_id_ref;
7683 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7684 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7685 LDKRevokeAndACK msg_conv;
7686 msg_conv.inner = (void*)(msg & (~1));
7687 msg_conv.is_owned = false;
7688 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7691 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) {
7692 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7693 LDKPublicKey their_node_id_ref;
7694 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7695 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7696 LDKUpdateFee msg_conv;
7697 msg_conv.inner = (void*)(msg & (~1));
7698 msg_conv.is_owned = false;
7699 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7702 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) {
7703 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7704 LDKPublicKey their_node_id_ref;
7705 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7706 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7707 LDKAnnouncementSignatures msg_conv;
7708 msg_conv.inner = (void*)(msg & (~1));
7709 msg_conv.is_owned = false;
7710 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7713 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) {
7714 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7715 LDKPublicKey their_node_id_ref;
7716 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7717 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7718 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7721 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) {
7722 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7723 LDKPublicKey their_node_id_ref;
7724 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7725 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7727 msg_conv.inner = (void*)(msg & (~1));
7728 msg_conv.is_owned = false;
7729 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7732 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) {
7733 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7734 LDKPublicKey their_node_id_ref;
7735 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7736 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7737 LDKChannelReestablish msg_conv;
7738 msg_conv.inner = (void*)(msg & (~1));
7739 msg_conv.is_owned = false;
7740 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7743 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) {
7744 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7745 LDKPublicKey their_node_id_ref;
7746 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7747 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7748 LDKChannelUpdate msg_conv;
7749 msg_conv.inner = (void*)(msg & (~1));
7750 msg_conv.is_owned = false;
7751 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7754 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) {
7755 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7756 LDKPublicKey their_node_id_ref;
7757 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7758 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7759 LDKErrorMessage msg_conv;
7760 msg_conv.inner = (void*)(msg & (~1));
7761 msg_conv.is_owned = false;
7762 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7765 typedef struct LDKRoutingMessageHandler_JCalls {
7766 atomic_size_t refcnt;
7769 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7770 jmethodID handle_node_announcement_meth;
7771 jmethodID handle_channel_announcement_meth;
7772 jmethodID handle_channel_update_meth;
7773 jmethodID handle_htlc_fail_channel_update_meth;
7774 jmethodID get_next_channel_announcements_meth;
7775 jmethodID get_next_node_announcements_meth;
7776 jmethodID sync_routing_table_meth;
7777 jmethodID handle_reply_channel_range_meth;
7778 jmethodID handle_reply_short_channel_ids_end_meth;
7779 jmethodID handle_query_channel_range_meth;
7780 jmethodID handle_query_short_channel_ids_meth;
7781 } LDKRoutingMessageHandler_JCalls;
7782 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7783 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7784 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7786 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7787 if (get_jenv_res == JNI_EDETACHED) {
7788 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7790 DO_ASSERT(get_jenv_res == JNI_OK);
7792 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7793 if (get_jenv_res == JNI_EDETACHED) {
7794 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7799 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7800 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7802 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7803 if (get_jenv_res == JNI_EDETACHED) {
7804 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7806 DO_ASSERT(get_jenv_res == JNI_OK);
7808 LDKNodeAnnouncement msg_var = *msg;
7809 msg_var = NodeAnnouncement_clone(msg);
7810 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7811 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7812 uint64_t msg_ref = (uint64_t)msg_var.inner;
7813 if (msg_var.is_owned) {
7816 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7818 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
7819 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7820 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7821 if (get_jenv_res == JNI_EDETACHED) {
7822 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7826 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7827 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7830 if (get_jenv_res == JNI_EDETACHED) {
7831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7833 DO_ASSERT(get_jenv_res == JNI_OK);
7835 LDKChannelAnnouncement msg_var = *msg;
7836 msg_var = ChannelAnnouncement_clone(msg);
7837 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7838 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7839 uint64_t msg_ref = (uint64_t)msg_var.inner;
7840 if (msg_var.is_owned) {
7843 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7845 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
7846 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7847 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7848 if (get_jenv_res == JNI_EDETACHED) {
7849 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7853 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7854 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7856 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7857 if (get_jenv_res == JNI_EDETACHED) {
7858 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7860 DO_ASSERT(get_jenv_res == JNI_OK);
7862 LDKChannelUpdate msg_var = *msg;
7863 msg_var = ChannelUpdate_clone(msg);
7864 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7865 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7866 uint64_t msg_ref = (uint64_t)msg_var.inner;
7867 if (msg_var.is_owned) {
7870 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7872 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
7873 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7874 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7875 if (get_jenv_res == JNI_EDETACHED) {
7876 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7880 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
7881 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7883 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7884 if (get_jenv_res == JNI_EDETACHED) {
7885 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7887 DO_ASSERT(get_jenv_res == JNI_OK);
7889 uint64_t ret_update = (uint64_t)update;
7890 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7892 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
7893 if (get_jenv_res == JNI_EDETACHED) {
7894 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7897 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7898 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7900 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7901 if (get_jenv_res == JNI_EDETACHED) {
7902 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7904 DO_ASSERT(get_jenv_res == JNI_OK);
7906 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7908 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
7909 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7910 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7911 if (ret_constr.datalen > 0)
7912 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7914 ret_constr.data = NULL;
7915 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7916 for (size_t l = 0; l < ret_constr.datalen; l++) {
7917 int64_t ret_conv_63 = ret_vals[l];
7918 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
7919 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
7920 ret_constr.data[l] = ret_conv_63_conv;
7922 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7923 if (get_jenv_res == JNI_EDETACHED) {
7924 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7928 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7929 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7931 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7932 if (get_jenv_res == JNI_EDETACHED) {
7933 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7935 DO_ASSERT(get_jenv_res == JNI_OK);
7937 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
7938 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
7939 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7941 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
7942 LDKCVec_NodeAnnouncementZ ret_constr;
7943 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7944 if (ret_constr.datalen > 0)
7945 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7947 ret_constr.data = NULL;
7948 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7949 for (size_t s = 0; s < ret_constr.datalen; s++) {
7950 int64_t ret_conv_18 = ret_vals[s];
7951 LDKNodeAnnouncement ret_conv_18_conv;
7952 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7953 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7954 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
7955 ret_constr.data[s] = ret_conv_18_conv;
7957 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7958 if (get_jenv_res == JNI_EDETACHED) {
7959 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7963 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7964 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7966 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7967 if (get_jenv_res == JNI_EDETACHED) {
7968 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7970 DO_ASSERT(get_jenv_res == JNI_OK);
7972 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7973 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7974 LDKInit init_var = *init;
7975 init_var = Init_clone(init);
7976 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7977 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7978 uint64_t init_ref = (uint64_t)init_var.inner;
7979 if (init_var.is_owned) {
7982 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7984 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
7985 if (get_jenv_res == JNI_EDETACHED) {
7986 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7989 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7990 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7992 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7993 if (get_jenv_res == JNI_EDETACHED) {
7994 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7996 DO_ASSERT(get_jenv_res == JNI_OK);
7998 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7999 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8000 LDKReplyChannelRange msg_var = msg;
8001 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8002 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8003 uint64_t msg_ref = (uint64_t)msg_var.inner;
8004 if (msg_var.is_owned) {
8007 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8009 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8010 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8011 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8012 if (get_jenv_res == JNI_EDETACHED) {
8013 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8017 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8018 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8020 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8021 if (get_jenv_res == JNI_EDETACHED) {
8022 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8024 DO_ASSERT(get_jenv_res == JNI_OK);
8026 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8027 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8028 LDKReplyShortChannelIdsEnd msg_var = msg;
8029 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8030 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8031 uint64_t msg_ref = (uint64_t)msg_var.inner;
8032 if (msg_var.is_owned) {
8035 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8037 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8038 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8039 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8040 if (get_jenv_res == JNI_EDETACHED) {
8041 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8045 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8046 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8048 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8049 if (get_jenv_res == JNI_EDETACHED) {
8050 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8052 DO_ASSERT(get_jenv_res == JNI_OK);
8054 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8055 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8056 LDKQueryChannelRange msg_var = msg;
8057 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8058 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8059 uint64_t msg_ref = (uint64_t)msg_var.inner;
8060 if (msg_var.is_owned) {
8063 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8065 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8066 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8067 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8068 if (get_jenv_res == JNI_EDETACHED) {
8069 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8073 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8074 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8076 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8077 if (get_jenv_res == JNI_EDETACHED) {
8078 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8080 DO_ASSERT(get_jenv_res == JNI_OK);
8082 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8083 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8084 LDKQueryShortChannelIds msg_var = msg;
8085 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8086 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8087 uint64_t msg_ref = (uint64_t)msg_var.inner;
8088 if (msg_var.is_owned) {
8091 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8093 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8094 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8095 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8096 if (get_jenv_res == JNI_EDETACHED) {
8097 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8101 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8102 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8103 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8104 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8105 return (void*) this_arg;
8107 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8108 jclass c = (*env)->GetObjectClass(env, o);
8110 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8111 atomic_init(&calls->refcnt, 1);
8112 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8113 calls->o = (*env)->NewWeakGlobalRef(env, o);
8114 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8115 CHECK(calls->handle_node_announcement_meth != NULL);
8116 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8117 CHECK(calls->handle_channel_announcement_meth != NULL);
8118 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8119 CHECK(calls->handle_channel_update_meth != NULL);
8120 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8121 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8122 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8123 CHECK(calls->get_next_channel_announcements_meth != NULL);
8124 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8125 CHECK(calls->get_next_node_announcements_meth != NULL);
8126 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8127 CHECK(calls->sync_routing_table_meth != NULL);
8128 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8129 CHECK(calls->handle_reply_channel_range_meth != NULL);
8130 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8131 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8132 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8133 CHECK(calls->handle_query_channel_range_meth != NULL);
8134 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8135 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8137 LDKRoutingMessageHandler ret = {
8138 .this_arg = (void*) calls,
8139 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8140 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8141 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8142 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8143 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8144 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8145 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8146 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8147 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8148 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8149 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8150 .free = LDKRoutingMessageHandler_JCalls_free,
8151 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8153 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8157 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8158 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8159 return (uint64_t)res_ptr;
8161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8162 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8163 LDKNodeAnnouncement msg_conv;
8164 msg_conv.inner = (void*)(msg & (~1));
8165 msg_conv.is_owned = false;
8166 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8167 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8168 return (uint64_t)ret_conv;
8171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8172 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8173 LDKChannelAnnouncement msg_conv;
8174 msg_conv.inner = (void*)(msg & (~1));
8175 msg_conv.is_owned = false;
8176 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8177 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8178 return (uint64_t)ret_conv;
8181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8182 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8183 LDKChannelUpdate msg_conv;
8184 msg_conv.inner = (void*)(msg & (~1));
8185 msg_conv.is_owned = false;
8186 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8187 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8188 return (uint64_t)ret_conv;
8191 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) {
8192 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8193 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8194 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8197 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) {
8198 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8199 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8200 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8201 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8202 for (size_t l = 0; l < ret_var.datalen; l++) {
8203 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8204 *ret_conv_63_ref = ret_var.data[l];
8205 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8207 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8212 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) {
8213 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8214 LDKPublicKey starting_point_ref;
8215 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8216 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8217 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8218 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8219 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8220 for (size_t s = 0; s < ret_var.datalen; s++) {
8221 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8222 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8223 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8224 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8225 if (ret_conv_18_var.is_owned) {
8226 ret_conv_18_ref |= 1;
8228 ret_arr_ptr[s] = ret_conv_18_ref;
8230 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8235 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) {
8236 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8237 LDKPublicKey their_node_id_ref;
8238 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8239 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8241 init_conv.inner = (void*)(init & (~1));
8242 init_conv.is_owned = false;
8243 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8246 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) {
8247 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8248 LDKPublicKey their_node_id_ref;
8249 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8250 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8251 LDKReplyChannelRange msg_conv;
8252 msg_conv.inner = (void*)(msg & (~1));
8253 msg_conv.is_owned = (msg & 1) || (msg == 0);
8254 msg_conv = ReplyChannelRange_clone(&msg_conv);
8255 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8256 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8257 return (uint64_t)ret_conv;
8260 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) {
8261 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8262 LDKPublicKey their_node_id_ref;
8263 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8264 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8265 LDKReplyShortChannelIdsEnd msg_conv;
8266 msg_conv.inner = (void*)(msg & (~1));
8267 msg_conv.is_owned = (msg & 1) || (msg == 0);
8268 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8269 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8270 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8271 return (uint64_t)ret_conv;
8274 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) {
8275 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8276 LDKPublicKey their_node_id_ref;
8277 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8278 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8279 LDKQueryChannelRange msg_conv;
8280 msg_conv.inner = (void*)(msg & (~1));
8281 msg_conv.is_owned = (msg & 1) || (msg == 0);
8282 msg_conv = QueryChannelRange_clone(&msg_conv);
8283 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8284 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8285 return (uint64_t)ret_conv;
8288 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) {
8289 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8290 LDKPublicKey their_node_id_ref;
8291 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8292 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8293 LDKQueryShortChannelIds msg_conv;
8294 msg_conv.inner = (void*)(msg & (~1));
8295 msg_conv.is_owned = (msg & 1) || (msg == 0);
8296 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8297 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8298 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8299 return (uint64_t)ret_conv;
8302 typedef struct LDKSocketDescriptor_JCalls {
8303 atomic_size_t refcnt;
8306 jmethodID send_data_meth;
8307 jmethodID disconnect_socket_meth;
8309 jmethodID hash_meth;
8310 } LDKSocketDescriptor_JCalls;
8311 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8312 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8313 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8315 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8316 if (get_jenv_res == JNI_EDETACHED) {
8317 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8319 DO_ASSERT(get_jenv_res == JNI_OK);
8321 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8322 if (get_jenv_res == JNI_EDETACHED) {
8323 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8328 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8329 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8331 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8332 if (get_jenv_res == JNI_EDETACHED) {
8333 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8335 DO_ASSERT(get_jenv_res == JNI_OK);
8337 LDKu8slice data_var = data;
8338 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8339 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8340 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8342 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8343 if (get_jenv_res == JNI_EDETACHED) {
8344 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8348 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8349 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8351 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8352 if (get_jenv_res == JNI_EDETACHED) {
8353 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8355 DO_ASSERT(get_jenv_res == JNI_OK);
8357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8359 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8360 if (get_jenv_res == JNI_EDETACHED) {
8361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8364 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8365 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8367 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8368 if (get_jenv_res == JNI_EDETACHED) {
8369 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8371 DO_ASSERT(get_jenv_res == JNI_OK);
8373 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8374 *other_arg_clone = SocketDescriptor_clone(other_arg);
8375 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8377 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8378 if (get_jenv_res == JNI_EDETACHED) {
8379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8383 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8384 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8386 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8387 if (get_jenv_res == JNI_EDETACHED) {
8388 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8390 DO_ASSERT(get_jenv_res == JNI_OK);
8392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8394 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8395 if (get_jenv_res == JNI_EDETACHED) {
8396 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8400 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8401 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8402 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8403 return (void*) this_arg;
8405 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8406 jclass c = (*env)->GetObjectClass(env, o);
8408 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8409 atomic_init(&calls->refcnt, 1);
8410 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8411 calls->o = (*env)->NewWeakGlobalRef(env, o);
8412 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8413 CHECK(calls->send_data_meth != NULL);
8414 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8415 CHECK(calls->disconnect_socket_meth != NULL);
8416 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8417 CHECK(calls->eq_meth != NULL);
8418 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8419 CHECK(calls->hash_meth != NULL);
8421 LDKSocketDescriptor ret = {
8422 .this_arg = (void*) calls,
8423 .send_data = send_data_LDKSocketDescriptor_jcall,
8424 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8425 .eq = eq_LDKSocketDescriptor_jcall,
8426 .hash = hash_LDKSocketDescriptor_jcall,
8427 .clone = LDKSocketDescriptor_JCalls_clone,
8428 .free = LDKSocketDescriptor_JCalls_free,
8432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8433 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8434 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8435 return (uint64_t)res_ptr;
8437 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) {
8438 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8439 LDKu8slice data_ref;
8440 data_ref.datalen = (*env)->GetArrayLength(env, data);
8441 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8442 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8443 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8448 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8449 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8453 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8454 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8458 typedef struct LDKChannelManagerPersister_JCalls {
8459 atomic_size_t refcnt;
8462 jmethodID persist_manager_meth;
8463 } LDKChannelManagerPersister_JCalls;
8464 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8465 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8466 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8468 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8469 if (get_jenv_res == JNI_EDETACHED) {
8470 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8472 DO_ASSERT(get_jenv_res == JNI_OK);
8474 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8475 if (get_jenv_res == JNI_EDETACHED) {
8476 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8481 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8482 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8484 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8485 if (get_jenv_res == JNI_EDETACHED) {
8486 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8488 DO_ASSERT(get_jenv_res == JNI_OK);
8490 LDKChannelManager channel_manager_var = *channel_manager;
8491 // Warning: we may need a move here but no clone is available for LDKChannelManager
8492 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8493 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8494 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8495 if (channel_manager_var.is_owned) {
8496 channel_manager_ref |= 1;
8498 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8500 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8501 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8502 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8503 if (get_jenv_res == JNI_EDETACHED) {
8504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8508 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8509 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8510 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8511 return (void*) this_arg;
8513 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8514 jclass c = (*env)->GetObjectClass(env, o);
8516 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8517 atomic_init(&calls->refcnt, 1);
8518 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8519 calls->o = (*env)->NewWeakGlobalRef(env, o);
8520 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8521 CHECK(calls->persist_manager_meth != NULL);
8523 LDKChannelManagerPersister ret = {
8524 .this_arg = (void*) calls,
8525 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8526 .free = LDKChannelManagerPersister_JCalls_free,
8530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8531 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8532 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8533 return (uint64_t)res_ptr;
8535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8536 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8537 LDKChannelManager channel_manager_conv;
8538 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8539 channel_manager_conv.is_owned = false;
8540 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8541 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8542 return (uint64_t)ret_conv;
8545 static jclass LDKFallback_SegWitProgram_class = NULL;
8546 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8547 static jclass LDKFallback_PubKeyHash_class = NULL;
8548 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8549 static jclass LDKFallback_ScriptHash_class = NULL;
8550 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8552 LDKFallback_SegWitProgram_class =
8553 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8554 CHECK(LDKFallback_SegWitProgram_class != NULL);
8555 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8556 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8557 LDKFallback_PubKeyHash_class =
8558 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8559 CHECK(LDKFallback_PubKeyHash_class != NULL);
8560 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8561 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8562 LDKFallback_ScriptHash_class =
8563 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8564 CHECK(LDKFallback_ScriptHash_class != NULL);
8565 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8566 CHECK(LDKFallback_ScriptHash_meth != NULL);
8568 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8569 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8571 case LDKFallback_SegWitProgram: {
8572 uint8_t version_val = obj->seg_wit_program.version._0;
8573 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8574 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8575 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8576 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8578 case LDKFallback_PubKeyHash: {
8579 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8580 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8581 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8583 case LDKFallback_ScriptHash: {
8584 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8585 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8586 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8591 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8592 LDKStr ret_str = _ldk_get_compiled_version();
8593 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8597 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8598 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8599 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8604 LDKTransaction _res_ref;
8605 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8606 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8607 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8608 _res_ref.data_is_owned = true;
8609 Transaction_free(_res_ref);
8612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8613 if ((_res & 1) != 0) return;
8614 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8616 TxOut_free(_res_conv);
8619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8620 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8621 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8622 *ret_ref = TxOut_clone(orig_conv);
8623 return (uint64_t)ret_ref;
8626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8627 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8633 CHECK((*env)->GetArrayLength(env, o) == 32);
8634 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8635 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8636 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8637 return (uint64_t)ret_conv;
8640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8641 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8642 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8643 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8644 return (uint64_t)ret_conv;
8647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8648 if ((_res & 1) != 0) return;
8649 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8651 CResult_SecretKeyErrorZ_free(_res_conv);
8654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8656 CHECK((*env)->GetArrayLength(env, o) == 33);
8657 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8658 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8659 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8660 return (uint64_t)ret_conv;
8663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8664 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8665 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8666 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8667 return (uint64_t)ret_conv;
8670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8671 if ((_res & 1) != 0) return;
8672 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8674 CResult_PublicKeyErrorZ_free(_res_conv);
8677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8678 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8679 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8680 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8681 return (uint64_t)ret_conv;
8684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8685 LDKTxCreationKeys o_conv;
8686 o_conv.inner = (void*)(o & (~1));
8687 o_conv.is_owned = (o & 1) || (o == 0);
8688 o_conv = TxCreationKeys_clone(&o_conv);
8689 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8690 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8691 return (uint64_t)ret_conv;
8694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8695 LDKDecodeError e_conv;
8696 e_conv.inner = (void*)(e & (~1));
8697 e_conv.is_owned = (e & 1) || (e == 0);
8698 e_conv = DecodeError_clone(&e_conv);
8699 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8700 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8701 return (uint64_t)ret_conv;
8704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8705 if ((_res & 1) != 0) return;
8706 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8708 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8712 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8713 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8714 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8715 return (uint64_t)ret_conv;
8718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8719 LDKChannelPublicKeys o_conv;
8720 o_conv.inner = (void*)(o & (~1));
8721 o_conv.is_owned = (o & 1) || (o == 0);
8722 o_conv = ChannelPublicKeys_clone(&o_conv);
8723 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8724 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8725 return (uint64_t)ret_conv;
8728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8729 LDKDecodeError e_conv;
8730 e_conv.inner = (void*)(e & (~1));
8731 e_conv.is_owned = (e & 1) || (e == 0);
8732 e_conv = DecodeError_clone(&e_conv);
8733 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8734 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8735 return (uint64_t)ret_conv;
8738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8739 if ((_res & 1) != 0) return;
8740 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8742 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8746 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8747 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8748 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8749 return (uint64_t)ret_conv;
8752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8753 LDKTxCreationKeys o_conv;
8754 o_conv.inner = (void*)(o & (~1));
8755 o_conv.is_owned = (o & 1) || (o == 0);
8756 o_conv = TxCreationKeys_clone(&o_conv);
8757 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8758 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8759 return (uint64_t)ret_conv;
8762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8763 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8764 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8765 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8766 return (uint64_t)ret_conv;
8769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8770 if ((_res & 1) != 0) return;
8771 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
8773 CResult_TxCreationKeysErrorZ_free(_res_conv);
8776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8777 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8778 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8779 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8780 return (uint64_t)ret_conv;
8783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
8784 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8785 *ret_copy = COption_u32Z_some(o);
8786 uint64_t ret_ref = (uint64_t)ret_copy;
8790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
8791 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8792 *ret_copy = COption_u32Z_none();
8793 uint64_t ret_ref = (uint64_t)ret_copy;
8797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8798 if ((_res & 1) != 0) return;
8799 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
8801 COption_u32Z_free(_res_conv);
8804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8805 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8806 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8807 *ret_copy = COption_u32Z_clone(orig_conv);
8808 uint64_t ret_ref = (uint64_t)ret_copy;
8812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8813 LDKHTLCOutputInCommitment o_conv;
8814 o_conv.inner = (void*)(o & (~1));
8815 o_conv.is_owned = (o & 1) || (o == 0);
8816 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8817 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8818 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8819 return (uint64_t)ret_conv;
8822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8823 LDKDecodeError e_conv;
8824 e_conv.inner = (void*)(e & (~1));
8825 e_conv.is_owned = (e & 1) || (e == 0);
8826 e_conv = DecodeError_clone(&e_conv);
8827 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8828 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8829 return (uint64_t)ret_conv;
8832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8833 if ((_res & 1) != 0) return;
8834 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
8836 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8840 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8841 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8842 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8843 return (uint64_t)ret_conv;
8846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8847 LDKCounterpartyChannelTransactionParameters o_conv;
8848 o_conv.inner = (void*)(o & (~1));
8849 o_conv.is_owned = (o & 1) || (o == 0);
8850 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8851 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8852 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8853 return (uint64_t)ret_conv;
8856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8857 LDKDecodeError e_conv;
8858 e_conv.inner = (void*)(e & (~1));
8859 e_conv.is_owned = (e & 1) || (e == 0);
8860 e_conv = DecodeError_clone(&e_conv);
8861 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8862 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8863 return (uint64_t)ret_conv;
8866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8867 if ((_res & 1) != 0) return;
8868 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8874 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8875 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8876 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8877 return (uint64_t)ret_conv;
8880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8881 LDKChannelTransactionParameters o_conv;
8882 o_conv.inner = (void*)(o & (~1));
8883 o_conv.is_owned = (o & 1) || (o == 0);
8884 o_conv = ChannelTransactionParameters_clone(&o_conv);
8885 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8886 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8887 return (uint64_t)ret_conv;
8890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8891 LDKDecodeError e_conv;
8892 e_conv.inner = (void*)(e & (~1));
8893 e_conv.is_owned = (e & 1) || (e == 0);
8894 e_conv = DecodeError_clone(&e_conv);
8895 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8896 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8897 return (uint64_t)ret_conv;
8900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8901 if ((_res & 1) != 0) return;
8902 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8904 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8908 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8909 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8910 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8911 return (uint64_t)ret_conv;
8914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8915 LDKCVec_SignatureZ _res_constr;
8916 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8917 if (_res_constr.datalen > 0)
8918 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8920 _res_constr.data = NULL;
8921 for (size_t i = 0; i < _res_constr.datalen; i++) {
8922 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8923 LDKSignature _res_conv_8_ref;
8924 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
8925 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
8926 _res_constr.data[i] = _res_conv_8_ref;
8928 CVec_SignatureZ_free(_res_constr);
8931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8932 LDKHolderCommitmentTransaction o_conv;
8933 o_conv.inner = (void*)(o & (~1));
8934 o_conv.is_owned = (o & 1) || (o == 0);
8935 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8936 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8937 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8938 return (uint64_t)ret_conv;
8941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8942 LDKDecodeError e_conv;
8943 e_conv.inner = (void*)(e & (~1));
8944 e_conv.is_owned = (e & 1) || (e == 0);
8945 e_conv = DecodeError_clone(&e_conv);
8946 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8947 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8948 return (uint64_t)ret_conv;
8951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8952 if ((_res & 1) != 0) return;
8953 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8955 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8959 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8960 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8961 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8962 return (uint64_t)ret_conv;
8965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8966 LDKBuiltCommitmentTransaction o_conv;
8967 o_conv.inner = (void*)(o & (~1));
8968 o_conv.is_owned = (o & 1) || (o == 0);
8969 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8970 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8971 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8972 return (uint64_t)ret_conv;
8975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8976 LDKDecodeError e_conv;
8977 e_conv.inner = (void*)(e & (~1));
8978 e_conv.is_owned = (e & 1) || (e == 0);
8979 e_conv = DecodeError_clone(&e_conv);
8980 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8981 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8982 return (uint64_t)ret_conv;
8985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8986 if ((_res & 1) != 0) return;
8987 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8989 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8993 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8994 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8995 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8996 return (uint64_t)ret_conv;
8999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9000 LDKCommitmentTransaction o_conv;
9001 o_conv.inner = (void*)(o & (~1));
9002 o_conv.is_owned = (o & 1) || (o == 0);
9003 o_conv = CommitmentTransaction_clone(&o_conv);
9004 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9005 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9006 return (uint64_t)ret_conv;
9009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9010 LDKDecodeError e_conv;
9011 e_conv.inner = (void*)(e & (~1));
9012 e_conv.is_owned = (e & 1) || (e == 0);
9013 e_conv = DecodeError_clone(&e_conv);
9014 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9015 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9016 return (uint64_t)ret_conv;
9019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9020 if ((_res & 1) != 0) return;
9021 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9023 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9027 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9028 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9029 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9030 return (uint64_t)ret_conv;
9033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9034 LDKTrustedCommitmentTransaction o_conv;
9035 o_conv.inner = (void*)(o & (~1));
9036 o_conv.is_owned = (o & 1) || (o == 0);
9037 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9038 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9039 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9040 return (uint64_t)ret_conv;
9043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9044 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9045 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9046 return (uint64_t)ret_conv;
9049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9050 if ((_res & 1) != 0) return;
9051 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9053 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9057 LDKCVec_SignatureZ o_constr;
9058 o_constr.datalen = (*env)->GetArrayLength(env, o);
9059 if (o_constr.datalen > 0)
9060 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9062 o_constr.data = NULL;
9063 for (size_t i = 0; i < o_constr.datalen; i++) {
9064 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9065 LDKSignature o_conv_8_ref;
9066 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9067 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9068 o_constr.data[i] = o_conv_8_ref;
9070 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9071 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9072 return (uint64_t)ret_conv;
9075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9076 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9077 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9078 return (uint64_t)ret_conv;
9081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9082 if ((_res & 1) != 0) return;
9083 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9085 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9089 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9090 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9091 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9092 return (uint64_t)ret_conv;
9095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9096 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9097 *ret_conv = CResult_NoneErrorZ_ok();
9098 return (uint64_t)ret_conv;
9101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9102 LDKIOError e_conv = LDKIOError_from_java(env, e);
9103 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9104 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9105 return (uint64_t)ret_conv;
9108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9109 if ((_res & 1) != 0) return;
9110 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9112 CResult_NoneErrorZ_free(_res_conv);
9115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9116 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9117 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9118 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9119 return (uint64_t)ret_conv;
9122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9124 o_conv.inner = (void*)(o & (~1));
9125 o_conv.is_owned = (o & 1) || (o == 0);
9126 o_conv = RouteHop_clone(&o_conv);
9127 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9128 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9129 return (uint64_t)ret_conv;
9132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9133 LDKDecodeError e_conv;
9134 e_conv.inner = (void*)(e & (~1));
9135 e_conv.is_owned = (e & 1) || (e == 0);
9136 e_conv = DecodeError_clone(&e_conv);
9137 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9138 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9139 return (uint64_t)ret_conv;
9142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9143 if ((_res & 1) != 0) return;
9144 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9146 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9150 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9151 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9152 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9153 return (uint64_t)ret_conv;
9156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9157 LDKCVec_RouteHopZ _res_constr;
9158 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9159 if (_res_constr.datalen > 0)
9160 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9162 _res_constr.data = NULL;
9163 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9164 for (size_t k = 0; k < _res_constr.datalen; k++) {
9165 int64_t _res_conv_10 = _res_vals[k];
9166 LDKRouteHop _res_conv_10_conv;
9167 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9168 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9169 _res_constr.data[k] = _res_conv_10_conv;
9171 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9172 CVec_RouteHopZ_free(_res_constr);
9175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9176 LDKCVec_CVec_RouteHopZZ _res_constr;
9177 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9178 if (_res_constr.datalen > 0)
9179 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9181 _res_constr.data = NULL;
9182 for (size_t m = 0; m < _res_constr.datalen; m++) {
9183 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9184 LDKCVec_RouteHopZ _res_conv_12_constr;
9185 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9186 if (_res_conv_12_constr.datalen > 0)
9187 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9189 _res_conv_12_constr.data = NULL;
9190 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9191 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9192 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9193 LDKRouteHop _res_conv_12_conv_10_conv;
9194 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9195 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9196 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9198 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9199 _res_constr.data[m] = _res_conv_12_constr;
9201 CVec_CVec_RouteHopZZ_free(_res_constr);
9204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9206 o_conv.inner = (void*)(o & (~1));
9207 o_conv.is_owned = (o & 1) || (o == 0);
9208 o_conv = Route_clone(&o_conv);
9209 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9210 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9211 return (uint64_t)ret_conv;
9214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9215 LDKDecodeError e_conv;
9216 e_conv.inner = (void*)(e & (~1));
9217 e_conv.is_owned = (e & 1) || (e == 0);
9218 e_conv = DecodeError_clone(&e_conv);
9219 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9220 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9221 return (uint64_t)ret_conv;
9224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9225 if ((_res & 1) != 0) return;
9226 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9228 CResult_RouteDecodeErrorZ_free(_res_conv);
9231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9232 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9233 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9234 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9235 return (uint64_t)ret_conv;
9238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9239 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9240 *ret_copy = COption_u64Z_some(o);
9241 uint64_t ret_ref = (uint64_t)ret_copy;
9245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9246 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9247 *ret_copy = COption_u64Z_none();
9248 uint64_t ret_ref = (uint64_t)ret_copy;
9252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9253 if ((_res & 1) != 0) return;
9254 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9256 COption_u64Z_free(_res_conv);
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9260 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9261 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9262 *ret_copy = COption_u64Z_clone(orig_conv);
9263 uint64_t ret_ref = (uint64_t)ret_copy;
9267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9268 LDKCVec_ChannelDetailsZ _res_constr;
9269 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9270 if (_res_constr.datalen > 0)
9271 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9273 _res_constr.data = NULL;
9274 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9275 for (size_t q = 0; q < _res_constr.datalen; q++) {
9276 int64_t _res_conv_16 = _res_vals[q];
9277 LDKChannelDetails _res_conv_16_conv;
9278 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9279 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9280 _res_constr.data[q] = _res_conv_16_conv;
9282 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9283 CVec_ChannelDetailsZ_free(_res_constr);
9286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9287 LDKCVec_RouteHintZ _res_constr;
9288 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9289 if (_res_constr.datalen > 0)
9290 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9292 _res_constr.data = NULL;
9293 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9294 for (size_t l = 0; l < _res_constr.datalen; l++) {
9295 int64_t _res_conv_11 = _res_vals[l];
9296 LDKRouteHint _res_conv_11_conv;
9297 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9298 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9299 _res_constr.data[l] = _res_conv_11_conv;
9301 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9302 CVec_RouteHintZ_free(_res_constr);
9305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9307 o_conv.inner = (void*)(o & (~1));
9308 o_conv.is_owned = (o & 1) || (o == 0);
9309 o_conv = Route_clone(&o_conv);
9310 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9311 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9312 return (uint64_t)ret_conv;
9315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9316 LDKLightningError e_conv;
9317 e_conv.inner = (void*)(e & (~1));
9318 e_conv.is_owned = (e & 1) || (e == 0);
9319 e_conv = LightningError_clone(&e_conv);
9320 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9321 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9322 return (uint64_t)ret_conv;
9325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9326 if ((_res & 1) != 0) return;
9327 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9329 CResult_RouteLightningErrorZ_free(_res_conv);
9332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9333 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9334 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9335 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9336 return (uint64_t)ret_conv;
9339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9340 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9341 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9342 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9343 return (uint64_t)ret_conv;
9346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9347 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9348 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9349 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9350 return (uint64_t)ret_conv;
9353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9354 if ((_res & 1) != 0) return;
9355 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9357 CResult_TxOutAccessErrorZ_free(_res_conv);
9360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9361 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9362 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9363 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9364 return (uint64_t)ret_conv;
9367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9368 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9369 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9370 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9371 return (uint64_t)ret_ref;
9374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9375 LDKTransaction b_ref;
9376 b_ref.datalen = (*env)->GetArrayLength(env, b);
9377 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9378 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9379 b_ref.data_is_owned = true;
9380 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9381 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9382 return (uint64_t)ret_ref;
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9386 if ((_res & 1) != 0) return;
9387 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9389 C2Tuple_usizeTransactionZ_free(_res_conv);
9392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9393 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9394 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9395 if (_res_constr.datalen > 0)
9396 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9398 _res_constr.data = NULL;
9399 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9400 for (size_t y = 0; y < _res_constr.datalen; y++) {
9401 int64_t _res_conv_24 = _res_vals[y];
9402 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9403 FREE((void*)_res_conv_24);
9404 _res_constr.data[y] = _res_conv_24_conv;
9406 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9407 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9411 LDKCVec_TxidZ _res_constr;
9412 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9413 if (_res_constr.datalen > 0)
9414 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9416 _res_constr.data = NULL;
9417 for (size_t i = 0; i < _res_constr.datalen; i++) {
9418 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9419 LDKThirtyTwoBytes _res_conv_8_ref;
9420 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9421 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9422 _res_constr.data[i] = _res_conv_8_ref;
9424 CVec_TxidZ_free(_res_constr);
9427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9428 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9429 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9430 return (uint64_t)ret_conv;
9433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9434 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9435 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9436 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9437 return (uint64_t)ret_conv;
9440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9441 if ((_res & 1) != 0) return;
9442 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9444 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9448 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9449 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9450 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9451 return (uint64_t)ret_conv;
9454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9455 LDKCVec_MonitorEventZ _res_constr;
9456 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9457 if (_res_constr.datalen > 0)
9458 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9460 _res_constr.data = NULL;
9461 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9462 for (size_t o = 0; o < _res_constr.datalen; o++) {
9463 int64_t _res_conv_14 = _res_vals[o];
9464 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9465 FREE((void*)_res_conv_14);
9466 _res_constr.data[o] = _res_conv_14_conv;
9468 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9469 CVec_MonitorEventZ_free(_res_constr);
9472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9473 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9474 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9475 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9476 uint64_t ret_ref = (uint64_t)ret_copy;
9480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9481 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9482 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9483 uint64_t ret_ref = (uint64_t)ret_copy;
9487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9488 if ((_res & 1) != 0) return;
9489 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9491 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9495 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9496 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9497 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9498 uint64_t ret_ref = (uint64_t)ret_copy;
9502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9503 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9504 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9505 if (_res_constr.datalen > 0)
9506 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9508 _res_constr.data = NULL;
9509 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9510 for (size_t b = 0; b < _res_constr.datalen; b++) {
9511 int64_t _res_conv_27 = _res_vals[b];
9512 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9513 FREE((void*)_res_conv_27);
9514 _res_constr.data[b] = _res_conv_27_conv;
9516 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9517 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9521 LDKCVec_MessageSendEventZ _res_constr;
9522 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9523 if (_res_constr.datalen > 0)
9524 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9526 _res_constr.data = NULL;
9527 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9528 for (size_t s = 0; s < _res_constr.datalen; s++) {
9529 int64_t _res_conv_18 = _res_vals[s];
9530 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9531 FREE((void*)_res_conv_18);
9532 _res_constr.data[s] = _res_conv_18_conv;
9534 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9535 CVec_MessageSendEventZ_free(_res_constr);
9538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9539 LDKInitFeatures o_conv;
9540 o_conv.inner = (void*)(o & (~1));
9541 o_conv.is_owned = (o & 1) || (o == 0);
9542 o_conv = InitFeatures_clone(&o_conv);
9543 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9544 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9545 return (uint64_t)ret_conv;
9548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9549 LDKDecodeError e_conv;
9550 e_conv.inner = (void*)(e & (~1));
9551 e_conv.is_owned = (e & 1) || (e == 0);
9552 e_conv = DecodeError_clone(&e_conv);
9553 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9554 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9555 return (uint64_t)ret_conv;
9558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9559 if ((_res & 1) != 0) return;
9560 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9562 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9566 LDKNodeFeatures o_conv;
9567 o_conv.inner = (void*)(o & (~1));
9568 o_conv.is_owned = (o & 1) || (o == 0);
9569 o_conv = NodeFeatures_clone(&o_conv);
9570 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9571 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9572 return (uint64_t)ret_conv;
9575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9576 LDKDecodeError e_conv;
9577 e_conv.inner = (void*)(e & (~1));
9578 e_conv.is_owned = (e & 1) || (e == 0);
9579 e_conv = DecodeError_clone(&e_conv);
9580 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9581 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9582 return (uint64_t)ret_conv;
9585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9586 if ((_res & 1) != 0) return;
9587 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9589 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9593 LDKChannelFeatures o_conv;
9594 o_conv.inner = (void*)(o & (~1));
9595 o_conv.is_owned = (o & 1) || (o == 0);
9596 o_conv = ChannelFeatures_clone(&o_conv);
9597 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9598 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9599 return (uint64_t)ret_conv;
9602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9603 LDKDecodeError e_conv;
9604 e_conv.inner = (void*)(e & (~1));
9605 e_conv.is_owned = (e & 1) || (e == 0);
9606 e_conv = DecodeError_clone(&e_conv);
9607 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9608 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9609 return (uint64_t)ret_conv;
9612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9613 if ((_res & 1) != 0) return;
9614 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9616 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9620 LDKInvoiceFeatures o_conv;
9621 o_conv.inner = (void*)(o & (~1));
9622 o_conv.is_owned = (o & 1) || (o == 0);
9623 o_conv = InvoiceFeatures_clone(&o_conv);
9624 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9625 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9626 return (uint64_t)ret_conv;
9629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9630 LDKDecodeError e_conv;
9631 e_conv.inner = (void*)(e & (~1));
9632 e_conv.is_owned = (e & 1) || (e == 0);
9633 e_conv = DecodeError_clone(&e_conv);
9634 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9635 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9636 return (uint64_t)ret_conv;
9639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9640 if ((_res & 1) != 0) return;
9641 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9643 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9647 LDKDelayedPaymentOutputDescriptor o_conv;
9648 o_conv.inner = (void*)(o & (~1));
9649 o_conv.is_owned = (o & 1) || (o == 0);
9650 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9651 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9652 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9653 return (uint64_t)ret_conv;
9656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9657 LDKDecodeError e_conv;
9658 e_conv.inner = (void*)(e & (~1));
9659 e_conv.is_owned = (e & 1) || (e == 0);
9660 e_conv = DecodeError_clone(&e_conv);
9661 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9662 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9663 return (uint64_t)ret_conv;
9666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9667 if ((_res & 1) != 0) return;
9668 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9670 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9674 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9675 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9676 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9677 return (uint64_t)ret_conv;
9680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9681 LDKStaticPaymentOutputDescriptor o_conv;
9682 o_conv.inner = (void*)(o & (~1));
9683 o_conv.is_owned = (o & 1) || (o == 0);
9684 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9685 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9686 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9687 return (uint64_t)ret_conv;
9690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9691 LDKDecodeError e_conv;
9692 e_conv.inner = (void*)(e & (~1));
9693 e_conv.is_owned = (e & 1) || (e == 0);
9694 e_conv = DecodeError_clone(&e_conv);
9695 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9696 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9697 return (uint64_t)ret_conv;
9700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9701 if ((_res & 1) != 0) return;
9702 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9704 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9708 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9709 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9710 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9711 return (uint64_t)ret_conv;
9714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9715 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
9716 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9717 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
9718 return (uint64_t)ret_conv;
9721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9722 LDKDecodeError e_conv;
9723 e_conv.inner = (void*)(e & (~1));
9724 e_conv.is_owned = (e & 1) || (e == 0);
9725 e_conv = DecodeError_clone(&e_conv);
9726 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9727 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
9728 return (uint64_t)ret_conv;
9731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9732 if ((_res & 1) != 0) return;
9733 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9735 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
9738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9739 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
9740 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9741 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
9742 return (uint64_t)ret_conv;
9745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9746 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
9747 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9748 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
9749 return (uint64_t)ret_ref;
9752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
9754 CHECK((*env)->GetArrayLength(env, a) == 64);
9755 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
9756 LDKCVec_SignatureZ b_constr;
9757 b_constr.datalen = (*env)->GetArrayLength(env, b);
9758 if (b_constr.datalen > 0)
9759 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9761 b_constr.data = NULL;
9762 for (size_t i = 0; i < b_constr.datalen; i++) {
9763 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
9764 LDKSignature b_conv_8_ref;
9765 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
9766 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
9767 b_constr.data[i] = b_conv_8_ref;
9769 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9770 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
9771 return (uint64_t)ret_ref;
9774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9775 if ((_res & 1) != 0) return;
9776 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
9778 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
9781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9782 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
9783 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9784 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
9785 return (uint64_t)ret_conv;
9788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
9789 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9790 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
9791 return (uint64_t)ret_conv;
9794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9795 if ((_res & 1) != 0) return;
9796 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
9798 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
9801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9802 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
9803 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9804 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
9805 return (uint64_t)ret_conv;
9808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9810 CHECK((*env)->GetArrayLength(env, o) == 64);
9811 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
9812 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9813 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
9814 return (uint64_t)ret_conv;
9817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9818 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9819 *ret_conv = CResult_SignatureNoneZ_err();
9820 return (uint64_t)ret_conv;
9823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9824 if ((_res & 1) != 0) return;
9825 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
9827 CResult_SignatureNoneZ_free(_res_conv);
9830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9831 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
9832 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9833 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
9834 return (uint64_t)ret_conv;
9837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9838 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
9839 if (o_conv.free == LDKSign_JCalls_free) {
9840 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9841 LDKSign_JCalls_clone(o_conv.this_arg);
9843 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9844 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
9845 return (uint64_t)ret_conv;
9848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9849 LDKDecodeError e_conv;
9850 e_conv.inner = (void*)(e & (~1));
9851 e_conv.is_owned = (e & 1) || (e == 0);
9852 e_conv = DecodeError_clone(&e_conv);
9853 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9854 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9855 return (uint64_t)ret_conv;
9858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9859 if ((_res & 1) != 0) return;
9860 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
9862 CResult_SignDecodeErrorZ_free(_res_conv);
9865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9866 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9867 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9868 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9869 return (uint64_t)ret_conv;
9872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9873 LDKCVec_u8Z _res_ref;
9874 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9875 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9876 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9877 CVec_u8Z_free(_res_ref);
9880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
9881 LDKRecoverableSignature arg_ref;
9882 CHECK((*env)->GetArrayLength(env, arg) == 68);
9883 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
9884 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9885 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9886 return (uint64_t)ret_conv;
9889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9890 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9891 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9892 return (uint64_t)ret_conv;
9895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9896 if ((_res & 1) != 0) return;
9897 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
9899 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9903 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9904 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9905 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9906 return (uint64_t)ret_conv;
9909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9910 LDKCVec_CVec_u8ZZ _res_constr;
9911 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9912 if (_res_constr.datalen > 0)
9913 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9915 _res_constr.data = NULL;
9916 for (size_t i = 0; i < _res_constr.datalen; i++) {
9917 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9918 LDKCVec_u8Z _res_conv_8_ref;
9919 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
9920 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9921 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
9922 _res_constr.data[i] = _res_conv_8_ref;
9924 CVec_CVec_u8ZZ_free(_res_constr);
9927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9928 LDKCVec_CVec_u8ZZ o_constr;
9929 o_constr.datalen = (*env)->GetArrayLength(env, o);
9930 if (o_constr.datalen > 0)
9931 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9933 o_constr.data = NULL;
9934 for (size_t i = 0; i < o_constr.datalen; i++) {
9935 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9936 LDKCVec_u8Z o_conv_8_ref;
9937 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
9938 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9939 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
9940 o_constr.data[i] = o_conv_8_ref;
9942 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9943 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9944 return (uint64_t)ret_conv;
9947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
9948 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9949 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9950 return (uint64_t)ret_conv;
9953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9954 if ((_res & 1) != 0) return;
9955 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
9957 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9961 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9962 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9963 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9964 return (uint64_t)ret_conv;
9967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9968 LDKInMemorySigner o_conv;
9969 o_conv.inner = (void*)(o & (~1));
9970 o_conv.is_owned = (o & 1) || (o == 0);
9971 o_conv = InMemorySigner_clone(&o_conv);
9972 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9973 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9974 return (uint64_t)ret_conv;
9977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9978 LDKDecodeError e_conv;
9979 e_conv.inner = (void*)(e & (~1));
9980 e_conv.is_owned = (e & 1) || (e == 0);
9981 e_conv = DecodeError_clone(&e_conv);
9982 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9983 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9984 return (uint64_t)ret_conv;
9987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9988 if ((_res & 1) != 0) return;
9989 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
9991 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9995 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9996 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9997 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
9998 return (uint64_t)ret_conv;
10001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10002 LDKCVec_TxOutZ _res_constr;
10003 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10004 if (_res_constr.datalen > 0)
10005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10007 _res_constr.data = NULL;
10008 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10009 for (size_t h = 0; h < _res_constr.datalen; h++) {
10010 int64_t _res_conv_7 = _res_vals[h];
10011 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10012 FREE((void*)_res_conv_7);
10013 _res_constr.data[h] = _res_conv_7_conv;
10015 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10016 CVec_TxOutZ_free(_res_constr);
10019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10020 LDKTransaction o_ref;
10021 o_ref.datalen = (*env)->GetArrayLength(env, o);
10022 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10023 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10024 o_ref.data_is_owned = true;
10025 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10026 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10027 return (uint64_t)ret_conv;
10030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10031 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10032 *ret_conv = CResult_TransactionNoneZ_err();
10033 return (uint64_t)ret_conv;
10036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10037 if ((_res & 1) != 0) return;
10038 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10040 CResult_TransactionNoneZ_free(_res_conv);
10043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10044 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10045 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10046 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10047 return (uint64_t)ret_conv;
10050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10051 LDKThirtyTwoBytes a_ref;
10052 CHECK((*env)->GetArrayLength(env, a) == 32);
10053 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10054 LDKChannelMonitor b_conv;
10055 b_conv.inner = (void*)(b & (~1));
10056 b_conv.is_owned = (b & 1) || (b == 0);
10057 b_conv = ChannelMonitor_clone(&b_conv);
10058 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10059 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10060 return (uint64_t)ret_ref;
10063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10064 if ((_res & 1) != 0) return;
10065 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10067 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10071 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10072 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10073 if (_res_constr.datalen > 0)
10074 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10076 _res_constr.data = NULL;
10077 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10078 for (size_t i = 0; i < _res_constr.datalen; i++) {
10079 int64_t _res_conv_34 = _res_vals[i];
10080 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10081 FREE((void*)_res_conv_34);
10082 _res_constr.data[i] = _res_conv_34_conv;
10084 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10085 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10089 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10090 o_constr.datalen = (*env)->GetArrayLength(env, o);
10091 if (o_constr.datalen > 0)
10092 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10094 o_constr.data = NULL;
10095 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10096 for (size_t i = 0; i < o_constr.datalen; i++) {
10097 int64_t o_conv_34 = o_vals[i];
10098 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10099 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10100 o_constr.data[i] = o_conv_34_conv;
10102 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10103 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10104 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10105 return (uint64_t)ret_conv;
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10109 LDKIOError e_conv = LDKIOError_from_java(env, e);
10110 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10111 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10112 return (uint64_t)ret_conv;
10115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10116 if ((_res & 1) != 0) return;
10117 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10119 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10123 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10124 *ret_conv = CResult_NoneAPIErrorZ_ok();
10125 return (uint64_t)ret_conv;
10128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10129 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10130 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10131 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10132 return (uint64_t)ret_conv;
10135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10136 if ((_res & 1) != 0) return;
10137 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10139 CResult_NoneAPIErrorZ_free(_res_conv);
10142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10143 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10144 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10145 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10146 return (uint64_t)ret_conv;
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10150 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10151 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10152 if (_res_constr.datalen > 0)
10153 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10155 _res_constr.data = NULL;
10156 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10157 for (size_t w = 0; w < _res_constr.datalen; w++) {
10158 int64_t _res_conv_22 = _res_vals[w];
10159 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10160 FREE((void*)_res_conv_22);
10161 _res_constr.data[w] = _res_conv_22_conv;
10163 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10164 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10168 LDKCVec_APIErrorZ _res_constr;
10169 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10170 if (_res_constr.datalen > 0)
10171 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10173 _res_constr.data = NULL;
10174 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10175 for (size_t k = 0; k < _res_constr.datalen; k++) {
10176 int64_t _res_conv_10 = _res_vals[k];
10177 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10178 FREE((void*)_res_conv_10);
10179 _res_constr.data[k] = _res_conv_10_conv;
10181 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10182 CVec_APIErrorZ_free(_res_constr);
10185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10186 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10187 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10188 return (uint64_t)ret_conv;
10191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10192 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10193 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10194 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10195 return (uint64_t)ret_conv;
10198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10199 if ((_res & 1) != 0) return;
10200 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10202 CResult_NonePaymentSendFailureZ_free(_res_conv);
10205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10206 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10207 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10208 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10209 return (uint64_t)ret_conv;
10212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10213 LDKCVec_NetAddressZ _res_constr;
10214 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10215 if (_res_constr.datalen > 0)
10216 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10218 _res_constr.data = NULL;
10219 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10220 for (size_t m = 0; m < _res_constr.datalen; m++) {
10221 int64_t _res_conv_12 = _res_vals[m];
10222 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10223 FREE((void*)_res_conv_12);
10224 _res_constr.data[m] = _res_conv_12_conv;
10226 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10227 CVec_NetAddressZ_free(_res_constr);
10230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10231 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10232 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10233 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10234 return (uint64_t)ret_ref;
10237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10238 LDKThirtyTwoBytes a_ref;
10239 CHECK((*env)->GetArrayLength(env, a) == 32);
10240 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10241 LDKThirtyTwoBytes b_ref;
10242 CHECK((*env)->GetArrayLength(env, b) == 32);
10243 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10244 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10245 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10246 return (uint64_t)ret_ref;
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10250 if ((_res & 1) != 0) return;
10251 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10253 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10257 LDKThirtyTwoBytes o_ref;
10258 CHECK((*env)->GetArrayLength(env, o) == 32);
10259 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10260 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10261 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10262 return (uint64_t)ret_conv;
10265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10266 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10267 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10268 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10269 return (uint64_t)ret_conv;
10272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10273 if ((_res & 1) != 0) return;
10274 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10276 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10280 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10281 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10282 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10283 return (uint64_t)ret_conv;
10286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10287 LDKCVec_ChannelMonitorZ _res_constr;
10288 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10289 if (_res_constr.datalen > 0)
10290 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10292 _res_constr.data = NULL;
10293 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10294 for (size_t q = 0; q < _res_constr.datalen; q++) {
10295 int64_t _res_conv_16 = _res_vals[q];
10296 LDKChannelMonitor _res_conv_16_conv;
10297 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10298 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10299 _res_constr.data[q] = _res_conv_16_conv;
10301 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10302 CVec_ChannelMonitorZ_free(_res_constr);
10305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10306 LDKThirtyTwoBytes a_ref;
10307 CHECK((*env)->GetArrayLength(env, a) == 32);
10308 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10309 LDKChannelManager b_conv;
10310 b_conv.inner = (void*)(b & (~1));
10311 b_conv.is_owned = (b & 1) || (b == 0);
10312 // Warning: we need a move here but no clone is available for LDKChannelManager
10313 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10314 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10315 return (uint64_t)ret_ref;
10318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10319 if ((_res & 1) != 0) return;
10320 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10322 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10326 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10327 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10328 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10329 return (uint64_t)ret_conv;
10332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10333 LDKDecodeError e_conv;
10334 e_conv.inner = (void*)(e & (~1));
10335 e_conv.is_owned = (e & 1) || (e == 0);
10336 e_conv = DecodeError_clone(&e_conv);
10337 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10338 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10339 return (uint64_t)ret_conv;
10342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10343 if ((_res & 1) != 0) return;
10344 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10346 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10350 LDKChannelConfig o_conv;
10351 o_conv.inner = (void*)(o & (~1));
10352 o_conv.is_owned = (o & 1) || (o == 0);
10353 o_conv = ChannelConfig_clone(&o_conv);
10354 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10355 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10356 return (uint64_t)ret_conv;
10359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10360 LDKDecodeError e_conv;
10361 e_conv.inner = (void*)(e & (~1));
10362 e_conv.is_owned = (e & 1) || (e == 0);
10363 e_conv = DecodeError_clone(&e_conv);
10364 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10365 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10366 return (uint64_t)ret_conv;
10369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10370 if ((_res & 1) != 0) return;
10371 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10373 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10377 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10378 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10379 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10380 return (uint64_t)ret_conv;
10383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10384 LDKOutPoint o_conv;
10385 o_conv.inner = (void*)(o & (~1));
10386 o_conv.is_owned = (o & 1) || (o == 0);
10387 o_conv = OutPoint_clone(&o_conv);
10388 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10389 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10390 return (uint64_t)ret_conv;
10393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10394 LDKDecodeError e_conv;
10395 e_conv.inner = (void*)(e & (~1));
10396 e_conv.is_owned = (e & 1) || (e == 0);
10397 e_conv = DecodeError_clone(&e_conv);
10398 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10399 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10400 return (uint64_t)ret_conv;
10403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10404 if ((_res & 1) != 0) return;
10405 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10407 CResult_OutPointDecodeErrorZ_free(_res_conv);
10410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10411 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10412 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10413 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10414 return (uint64_t)ret_conv;
10417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10418 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10419 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10420 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10421 return (uint64_t)ret_conv;
10424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10425 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10426 *ret_conv = CResult_SiPrefixNoneZ_err();
10427 return (uint64_t)ret_conv;
10430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10431 if ((_res & 1) != 0) return;
10432 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10434 CResult_SiPrefixNoneZ_free(_res_conv);
10437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10438 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10439 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10440 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10441 return (uint64_t)ret_conv;
10444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10446 o_conv.inner = (void*)(o & (~1));
10447 o_conv.is_owned = (o & 1) || (o == 0);
10448 o_conv = Invoice_clone(&o_conv);
10449 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10450 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10451 return (uint64_t)ret_conv;
10454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10455 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10456 *ret_conv = CResult_InvoiceNoneZ_err();
10457 return (uint64_t)ret_conv;
10460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10461 if ((_res & 1) != 0) return;
10462 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10464 CResult_InvoiceNoneZ_free(_res_conv);
10467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10468 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10469 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10470 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10471 return (uint64_t)ret_conv;
10474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10475 LDKSignedRawInvoice o_conv;
10476 o_conv.inner = (void*)(o & (~1));
10477 o_conv.is_owned = (o & 1) || (o == 0);
10478 o_conv = SignedRawInvoice_clone(&o_conv);
10479 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10480 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10481 return (uint64_t)ret_conv;
10484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10485 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10486 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10487 return (uint64_t)ret_conv;
10490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10491 if ((_res & 1) != 0) return;
10492 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10494 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10498 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10499 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10500 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10501 return (uint64_t)ret_conv;
10504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10505 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10506 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10507 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10508 return (uint64_t)ret_ref;
10511 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) {
10512 LDKRawInvoice a_conv;
10513 a_conv.inner = (void*)(a & (~1));
10514 a_conv.is_owned = (a & 1) || (a == 0);
10515 a_conv = RawInvoice_clone(&a_conv);
10516 LDKThirtyTwoBytes b_ref;
10517 CHECK((*env)->GetArrayLength(env, b) == 32);
10518 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10519 LDKInvoiceSignature c_conv;
10520 c_conv.inner = (void*)(c & (~1));
10521 c_conv.is_owned = (c & 1) || (c == 0);
10522 c_conv = InvoiceSignature_clone(&c_conv);
10523 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10524 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10525 return (uint64_t)ret_ref;
10528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10529 if ((_res & 1) != 0) return;
10530 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10532 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10536 LDKPayeePubKey o_conv;
10537 o_conv.inner = (void*)(o & (~1));
10538 o_conv.is_owned = (o & 1) || (o == 0);
10539 o_conv = PayeePubKey_clone(&o_conv);
10540 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10541 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10542 return (uint64_t)ret_conv;
10545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10546 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10547 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10548 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10549 return (uint64_t)ret_conv;
10552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10553 if ((_res & 1) != 0) return;
10554 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10556 CResult_PayeePubKeyErrorZ_free(_res_conv);
10559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10560 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10561 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10562 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10563 return (uint64_t)ret_conv;
10566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10567 LDKCVec_PrivateRouteZ _res_constr;
10568 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10569 if (_res_constr.datalen > 0)
10570 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10572 _res_constr.data = NULL;
10573 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10574 for (size_t o = 0; o < _res_constr.datalen; o++) {
10575 int64_t _res_conv_14 = _res_vals[o];
10576 LDKPrivateRoute _res_conv_14_conv;
10577 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10578 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10579 _res_constr.data[o] = _res_conv_14_conv;
10581 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10582 CVec_PrivateRouteZ_free(_res_constr);
10585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10586 LDKPositiveTimestamp o_conv;
10587 o_conv.inner = (void*)(o & (~1));
10588 o_conv.is_owned = (o & 1) || (o == 0);
10589 o_conv = PositiveTimestamp_clone(&o_conv);
10590 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10591 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10592 return (uint64_t)ret_conv;
10595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10596 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10597 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10598 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10599 return (uint64_t)ret_conv;
10602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10603 if ((_res & 1) != 0) return;
10604 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10606 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10610 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10611 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10612 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10613 return (uint64_t)ret_conv;
10616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10617 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10618 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10619 return (uint64_t)ret_conv;
10622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10623 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10624 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10625 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10626 return (uint64_t)ret_conv;
10629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10630 if ((_res & 1) != 0) return;
10631 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10633 CResult_NoneSemanticErrorZ_free(_res_conv);
10636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10637 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10638 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10639 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10640 return (uint64_t)ret_conv;
10643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10645 o_conv.inner = (void*)(o & (~1));
10646 o_conv.is_owned = (o & 1) || (o == 0);
10647 o_conv = Invoice_clone(&o_conv);
10648 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10649 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10650 return (uint64_t)ret_conv;
10653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10654 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10655 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10656 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10657 return (uint64_t)ret_conv;
10660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10661 if ((_res & 1) != 0) return;
10662 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10664 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10668 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10669 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10670 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10671 return (uint64_t)ret_conv;
10674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10675 LDKDescription o_conv;
10676 o_conv.inner = (void*)(o & (~1));
10677 o_conv.is_owned = (o & 1) || (o == 0);
10678 o_conv = Description_clone(&o_conv);
10679 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10680 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10681 return (uint64_t)ret_conv;
10684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10685 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10686 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10687 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10688 return (uint64_t)ret_conv;
10691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10692 if ((_res & 1) != 0) return;
10693 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10695 CResult_DescriptionCreationErrorZ_free(_res_conv);
10698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10699 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10700 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10701 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10702 return (uint64_t)ret_conv;
10705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10706 LDKExpiryTime o_conv;
10707 o_conv.inner = (void*)(o & (~1));
10708 o_conv.is_owned = (o & 1) || (o == 0);
10709 o_conv = ExpiryTime_clone(&o_conv);
10710 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10711 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10712 return (uint64_t)ret_conv;
10715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10716 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10717 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10718 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10719 return (uint64_t)ret_conv;
10722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10723 if ((_res & 1) != 0) return;
10724 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
10726 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10730 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10731 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10732 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10733 return (uint64_t)ret_conv;
10736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10737 LDKPrivateRoute o_conv;
10738 o_conv.inner = (void*)(o & (~1));
10739 o_conv.is_owned = (o & 1) || (o == 0);
10740 o_conv = PrivateRoute_clone(&o_conv);
10741 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10742 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
10743 return (uint64_t)ret_conv;
10746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10747 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10748 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10749 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
10750 return (uint64_t)ret_conv;
10753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10754 if ((_res & 1) != 0) return;
10755 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
10757 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10761 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10762 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10763 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10764 return (uint64_t)ret_conv;
10767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
10768 LDKStr o_conv = java_to_owned_str(env, o);
10769 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10770 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10771 return (uint64_t)ret_conv;
10774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10775 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10776 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10777 *ret_conv = CResult_StringErrorZ_err(e_conv);
10778 return (uint64_t)ret_conv;
10781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10782 if ((_res & 1) != 0) return;
10783 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
10785 CResult_StringErrorZ_free(_res_conv);
10788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10789 LDKChannelMonitorUpdate o_conv;
10790 o_conv.inner = (void*)(o & (~1));
10791 o_conv.is_owned = (o & 1) || (o == 0);
10792 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10793 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10794 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10795 return (uint64_t)ret_conv;
10798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10799 LDKDecodeError e_conv;
10800 e_conv.inner = (void*)(e & (~1));
10801 e_conv.is_owned = (e & 1) || (e == 0);
10802 e_conv = DecodeError_clone(&e_conv);
10803 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10804 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10805 return (uint64_t)ret_conv;
10808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10809 if ((_res & 1) != 0) return;
10810 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10812 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10816 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10817 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10818 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10819 return (uint64_t)ret_conv;
10822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10823 LDKHTLCUpdate o_conv;
10824 o_conv.inner = (void*)(o & (~1));
10825 o_conv.is_owned = (o & 1) || (o == 0);
10826 o_conv = HTLCUpdate_clone(&o_conv);
10827 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10828 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10829 return (uint64_t)ret_conv;
10832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10833 LDKDecodeError e_conv;
10834 e_conv.inner = (void*)(e & (~1));
10835 e_conv.is_owned = (e & 1) || (e == 0);
10836 e_conv = DecodeError_clone(&e_conv);
10837 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10838 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10839 return (uint64_t)ret_conv;
10842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10843 if ((_res & 1) != 0) return;
10844 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10846 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10850 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10851 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10852 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10853 return (uint64_t)ret_conv;
10856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
10857 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10858 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10859 return (uint64_t)ret_conv;
10862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10863 LDKMonitorUpdateError e_conv;
10864 e_conv.inner = (void*)(e & (~1));
10865 e_conv.is_owned = (e & 1) || (e == 0);
10866 e_conv = MonitorUpdateError_clone(&e_conv);
10867 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10868 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10869 return (uint64_t)ret_conv;
10872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10873 if ((_res & 1) != 0) return;
10874 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
10876 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10880 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10881 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10882 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10883 return (uint64_t)ret_conv;
10886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10887 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10888 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10889 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
10890 return (uint64_t)ret_ref;
10893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10894 LDKOutPoint a_conv;
10895 a_conv.inner = (void*)(a & (~1));
10896 a_conv.is_owned = (a & 1) || (a == 0);
10897 a_conv = OutPoint_clone(&a_conv);
10899 b_ref.datalen = (*env)->GetArrayLength(env, b);
10900 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10901 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10902 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10903 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10904 return (uint64_t)ret_ref;
10907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10908 if ((_res & 1) != 0) return;
10909 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
10911 C2Tuple_OutPointScriptZ_free(_res_conv);
10914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10915 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10916 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10917 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
10918 return (uint64_t)ret_ref;
10921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
10923 b_ref.datalen = (*env)->GetArrayLength(env, b);
10924 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10925 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10926 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10927 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
10928 return (uint64_t)ret_ref;
10931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10932 if ((_res & 1) != 0) return;
10933 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
10935 C2Tuple_u32ScriptZ_free(_res_conv);
10938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10939 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10940 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10941 if (_res_constr.datalen > 0)
10942 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10944 _res_constr.data = NULL;
10945 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10946 for (size_t b = 0; b < _res_constr.datalen; b++) {
10947 int64_t _res_conv_27 = _res_vals[b];
10948 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
10949 FREE((void*)_res_conv_27);
10950 _res_constr.data[b] = _res_conv_27_conv;
10952 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10953 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10957 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10958 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10959 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10960 return (uint64_t)ret_ref;
10963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
10964 LDKThirtyTwoBytes a_ref;
10965 CHECK((*env)->GetArrayLength(env, a) == 32);
10966 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10967 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10968 b_constr.datalen = (*env)->GetArrayLength(env, b);
10969 if (b_constr.datalen > 0)
10970 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10972 b_constr.data = NULL;
10973 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
10974 for (size_t b = 0; b < b_constr.datalen; b++) {
10975 int64_t b_conv_27 = b_vals[b];
10976 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
10977 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
10978 b_constr.data[b] = b_conv_27_conv;
10980 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
10981 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10982 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10983 return (uint64_t)ret_ref;
10986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10987 if ((_res & 1) != 0) return;
10988 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
10990 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10994 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10995 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10996 if (_res_constr.datalen > 0)
10997 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10999 _res_constr.data = NULL;
11000 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11001 for (size_t v = 0; v < _res_constr.datalen; v++) {
11002 int64_t _res_conv_47 = _res_vals[v];
11003 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11004 FREE((void*)_res_conv_47);
11005 _res_constr.data[v] = _res_conv_47_conv;
11007 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11008 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11012 LDKCVec_EventZ _res_constr;
11013 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11014 if (_res_constr.datalen > 0)
11015 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11017 _res_constr.data = NULL;
11018 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11019 for (size_t h = 0; h < _res_constr.datalen; h++) {
11020 int64_t _res_conv_7 = _res_vals[h];
11021 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11022 FREE((void*)_res_conv_7);
11023 _res_constr.data[h] = _res_conv_7_conv;
11025 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11026 CVec_EventZ_free(_res_constr);
11029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11030 LDKCVec_TransactionZ _res_constr;
11031 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11032 if (_res_constr.datalen > 0)
11033 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11035 _res_constr.data = NULL;
11036 for (size_t i = 0; i < _res_constr.datalen; i++) {
11037 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11038 LDKTransaction _res_conv_8_ref;
11039 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11040 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11041 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11042 _res_conv_8_ref.data_is_owned = true;
11043 _res_constr.data[i] = _res_conv_8_ref;
11045 CVec_TransactionZ_free(_res_constr);
11048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11049 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11050 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11051 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11052 return (uint64_t)ret_ref;
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11056 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11057 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11058 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11059 return (uint64_t)ret_ref;
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11063 if ((_res & 1) != 0) return;
11064 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11066 C2Tuple_u32TxOutZ_free(_res_conv);
11069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11070 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11071 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11072 if (_res_constr.datalen > 0)
11073 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11075 _res_constr.data = NULL;
11076 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11077 for (size_t a = 0; a < _res_constr.datalen; a++) {
11078 int64_t _res_conv_26 = _res_vals[a];
11079 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11080 FREE((void*)_res_conv_26);
11081 _res_constr.data[a] = _res_conv_26_conv;
11083 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11084 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11088 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11089 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11090 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11091 return (uint64_t)ret_ref;
11094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11095 LDKThirtyTwoBytes a_ref;
11096 CHECK((*env)->GetArrayLength(env, a) == 32);
11097 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11098 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11099 b_constr.datalen = (*env)->GetArrayLength(env, b);
11100 if (b_constr.datalen > 0)
11101 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11103 b_constr.data = NULL;
11104 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11105 for (size_t a = 0; a < b_constr.datalen; a++) {
11106 int64_t b_conv_26 = b_vals[a];
11107 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11108 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11109 b_constr.data[a] = b_conv_26_conv;
11111 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11112 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11113 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11114 return (uint64_t)ret_ref;
11117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11118 if ((_res & 1) != 0) return;
11119 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11121 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11125 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11126 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11127 if (_res_constr.datalen > 0)
11128 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11130 _res_constr.data = NULL;
11131 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11132 for (size_t u = 0; u < _res_constr.datalen; u++) {
11133 int64_t _res_conv_46 = _res_vals[u];
11134 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11135 FREE((void*)_res_conv_46);
11136 _res_constr.data[u] = _res_conv_46_conv;
11138 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11139 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11143 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11144 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11145 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11146 return (uint64_t)ret_conv;
11149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11150 LDKDecodeError e_conv;
11151 e_conv.inner = (void*)(e & (~1));
11152 e_conv.is_owned = (e & 1) || (e == 0);
11153 e_conv = DecodeError_clone(&e_conv);
11154 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11155 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11156 return (uint64_t)ret_conv;
11159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11160 if ((_res & 1) != 0) return;
11161 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11163 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11167 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11168 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11169 return (uint64_t)ret_conv;
11172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11173 LDKLightningError e_conv;
11174 e_conv.inner = (void*)(e & (~1));
11175 e_conv.is_owned = (e & 1) || (e == 0);
11176 e_conv = LightningError_clone(&e_conv);
11177 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11178 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11179 return (uint64_t)ret_conv;
11182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11183 if ((_res & 1) != 0) return;
11184 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11186 CResult_boolLightningErrorZ_free(_res_conv);
11189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11190 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11191 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11192 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11193 return (uint64_t)ret_conv;
11196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11197 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11198 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11199 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11200 return (uint64_t)ret_ref;
11203 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) {
11204 LDKChannelAnnouncement a_conv;
11205 a_conv.inner = (void*)(a & (~1));
11206 a_conv.is_owned = (a & 1) || (a == 0);
11207 a_conv = ChannelAnnouncement_clone(&a_conv);
11208 LDKChannelUpdate b_conv;
11209 b_conv.inner = (void*)(b & (~1));
11210 b_conv.is_owned = (b & 1) || (b == 0);
11211 b_conv = ChannelUpdate_clone(&b_conv);
11212 LDKChannelUpdate c_conv;
11213 c_conv.inner = (void*)(c & (~1));
11214 c_conv.is_owned = (c & 1) || (c == 0);
11215 c_conv = ChannelUpdate_clone(&c_conv);
11216 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11217 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11218 return (uint64_t)ret_ref;
11221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11222 if ((_res & 1) != 0) return;
11223 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11225 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11229 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11230 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11231 if (_res_constr.datalen > 0)
11232 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11234 _res_constr.data = NULL;
11235 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11236 for (size_t l = 0; l < _res_constr.datalen; l++) {
11237 int64_t _res_conv_63 = _res_vals[l];
11238 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11239 FREE((void*)_res_conv_63);
11240 _res_constr.data[l] = _res_conv_63_conv;
11242 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11243 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11247 LDKCVec_NodeAnnouncementZ _res_constr;
11248 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11249 if (_res_constr.datalen > 0)
11250 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11252 _res_constr.data = NULL;
11253 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11254 for (size_t s = 0; s < _res_constr.datalen; s++) {
11255 int64_t _res_conv_18 = _res_vals[s];
11256 LDKNodeAnnouncement _res_conv_18_conv;
11257 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11258 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11259 _res_constr.data[s] = _res_conv_18_conv;
11261 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11262 CVec_NodeAnnouncementZ_free(_res_constr);
11265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11266 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11267 *ret_conv = CResult_NoneLightningErrorZ_ok();
11268 return (uint64_t)ret_conv;
11271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11272 LDKLightningError e_conv;
11273 e_conv.inner = (void*)(e & (~1));
11274 e_conv.is_owned = (e & 1) || (e == 0);
11275 e_conv = LightningError_clone(&e_conv);
11276 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11277 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11278 return (uint64_t)ret_conv;
11281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11282 if ((_res & 1) != 0) return;
11283 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11285 CResult_NoneLightningErrorZ_free(_res_conv);
11288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11289 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11290 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11291 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11292 return (uint64_t)ret_conv;
11295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11296 LDKCVec_PublicKeyZ _res_constr;
11297 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11298 if (_res_constr.datalen > 0)
11299 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11301 _res_constr.data = NULL;
11302 for (size_t i = 0; i < _res_constr.datalen; i++) {
11303 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11304 LDKPublicKey _res_conv_8_ref;
11305 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11306 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11307 _res_constr.data[i] = _res_conv_8_ref;
11309 CVec_PublicKeyZ_free(_res_constr);
11312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11314 o_ref.datalen = (*env)->GetArrayLength(env, o);
11315 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11316 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11317 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11318 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11319 return (uint64_t)ret_conv;
11322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11323 LDKPeerHandleError e_conv;
11324 e_conv.inner = (void*)(e & (~1));
11325 e_conv.is_owned = (e & 1) || (e == 0);
11326 e_conv = PeerHandleError_clone(&e_conv);
11327 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11328 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11329 return (uint64_t)ret_conv;
11332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11333 if ((_res & 1) != 0) return;
11334 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11336 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11340 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11341 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11342 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11343 return (uint64_t)ret_conv;
11346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11347 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11348 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11349 return (uint64_t)ret_conv;
11352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11353 LDKPeerHandleError e_conv;
11354 e_conv.inner = (void*)(e & (~1));
11355 e_conv.is_owned = (e & 1) || (e == 0);
11356 e_conv = PeerHandleError_clone(&e_conv);
11357 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11358 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11359 return (uint64_t)ret_conv;
11362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11363 if ((_res & 1) != 0) return;
11364 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11366 CResult_NonePeerHandleErrorZ_free(_res_conv);
11369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11370 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11371 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11372 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11373 return (uint64_t)ret_conv;
11376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11377 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11378 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11379 return (uint64_t)ret_conv;
11382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11383 LDKPeerHandleError e_conv;
11384 e_conv.inner = (void*)(e & (~1));
11385 e_conv.is_owned = (e & 1) || (e == 0);
11386 e_conv = PeerHandleError_clone(&e_conv);
11387 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11388 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11389 return (uint64_t)ret_conv;
11392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11393 if ((_res & 1) != 0) return;
11394 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11396 CResult_boolPeerHandleErrorZ_free(_res_conv);
11399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11400 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11401 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11402 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11403 return (uint64_t)ret_conv;
11406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11407 LDKDirectionalChannelInfo o_conv;
11408 o_conv.inner = (void*)(o & (~1));
11409 o_conv.is_owned = (o & 1) || (o == 0);
11410 o_conv = DirectionalChannelInfo_clone(&o_conv);
11411 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11412 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11413 return (uint64_t)ret_conv;
11416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11417 LDKDecodeError e_conv;
11418 e_conv.inner = (void*)(e & (~1));
11419 e_conv.is_owned = (e & 1) || (e == 0);
11420 e_conv = DecodeError_clone(&e_conv);
11421 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11422 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11423 return (uint64_t)ret_conv;
11426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11427 if ((_res & 1) != 0) return;
11428 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11430 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11434 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11435 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11436 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11437 return (uint64_t)ret_conv;
11440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11441 LDKChannelInfo o_conv;
11442 o_conv.inner = (void*)(o & (~1));
11443 o_conv.is_owned = (o & 1) || (o == 0);
11444 o_conv = ChannelInfo_clone(&o_conv);
11445 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11446 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11447 return (uint64_t)ret_conv;
11450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11451 LDKDecodeError e_conv;
11452 e_conv.inner = (void*)(e & (~1));
11453 e_conv.is_owned = (e & 1) || (e == 0);
11454 e_conv = DecodeError_clone(&e_conv);
11455 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11456 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11457 return (uint64_t)ret_conv;
11460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11461 if ((_res & 1) != 0) return;
11462 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11464 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11468 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11469 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11470 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11471 return (uint64_t)ret_conv;
11474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11475 LDKRoutingFees o_conv;
11476 o_conv.inner = (void*)(o & (~1));
11477 o_conv.is_owned = (o & 1) || (o == 0);
11478 o_conv = RoutingFees_clone(&o_conv);
11479 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11480 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11481 return (uint64_t)ret_conv;
11484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11485 LDKDecodeError e_conv;
11486 e_conv.inner = (void*)(e & (~1));
11487 e_conv.is_owned = (e & 1) || (e == 0);
11488 e_conv = DecodeError_clone(&e_conv);
11489 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11490 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11491 return (uint64_t)ret_conv;
11494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11495 if ((_res & 1) != 0) return;
11496 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11498 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11502 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11503 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11504 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11505 return (uint64_t)ret_conv;
11508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11509 LDKNodeAnnouncementInfo o_conv;
11510 o_conv.inner = (void*)(o & (~1));
11511 o_conv.is_owned = (o & 1) || (o == 0);
11512 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11513 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11514 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11515 return (uint64_t)ret_conv;
11518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11519 LDKDecodeError e_conv;
11520 e_conv.inner = (void*)(e & (~1));
11521 e_conv.is_owned = (e & 1) || (e == 0);
11522 e_conv = DecodeError_clone(&e_conv);
11523 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11524 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11525 return (uint64_t)ret_conv;
11528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11529 if ((_res & 1) != 0) return;
11530 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11532 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11536 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11537 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11538 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11539 return (uint64_t)ret_conv;
11542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11543 LDKCVec_u64Z _res_constr;
11544 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11545 if (_res_constr.datalen > 0)
11546 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11548 _res_constr.data = NULL;
11549 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11550 for (size_t g = 0; g < _res_constr.datalen; g++) {
11551 int64_t _res_conv_6 = _res_vals[g];
11552 _res_constr.data[g] = _res_conv_6;
11554 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11555 CVec_u64Z_free(_res_constr);
11558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11559 LDKNodeInfo o_conv;
11560 o_conv.inner = (void*)(o & (~1));
11561 o_conv.is_owned = (o & 1) || (o == 0);
11562 o_conv = NodeInfo_clone(&o_conv);
11563 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11564 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11565 return (uint64_t)ret_conv;
11568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11569 LDKDecodeError e_conv;
11570 e_conv.inner = (void*)(e & (~1));
11571 e_conv.is_owned = (e & 1) || (e == 0);
11572 e_conv = DecodeError_clone(&e_conv);
11573 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11574 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11575 return (uint64_t)ret_conv;
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11579 if ((_res & 1) != 0) return;
11580 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11582 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11586 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11587 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11588 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11589 return (uint64_t)ret_conv;
11592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11593 LDKNetworkGraph o_conv;
11594 o_conv.inner = (void*)(o & (~1));
11595 o_conv.is_owned = (o & 1) || (o == 0);
11596 o_conv = NetworkGraph_clone(&o_conv);
11597 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11598 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11599 return (uint64_t)ret_conv;
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11603 LDKDecodeError e_conv;
11604 e_conv.inner = (void*)(e & (~1));
11605 e_conv.is_owned = (e & 1) || (e == 0);
11606 e_conv = DecodeError_clone(&e_conv);
11607 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11608 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11609 return (uint64_t)ret_conv;
11612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11613 if ((_res & 1) != 0) return;
11614 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11616 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11620 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11621 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11622 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11623 return (uint64_t)ret_conv;
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11627 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11628 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11629 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11630 return (uint64_t)ret_conv;
11633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11634 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11635 *ret_conv = CResult_NetAddressu8Z_err(e);
11636 return (uint64_t)ret_conv;
11639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11640 if ((_res & 1) != 0) return;
11641 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11643 CResult_NetAddressu8Z_free(_res_conv);
11646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11647 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11648 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11649 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11650 return (uint64_t)ret_conv;
11653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11654 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11655 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11656 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11657 return (uint64_t)ret_conv;
11660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11661 LDKDecodeError e_conv;
11662 e_conv.inner = (void*)(e & (~1));
11663 e_conv.is_owned = (e & 1) || (e == 0);
11664 e_conv = DecodeError_clone(&e_conv);
11665 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11666 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11667 return (uint64_t)ret_conv;
11670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11671 if ((_res & 1) != 0) return;
11672 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11674 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11678 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11679 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11680 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11681 return (uint64_t)ret_conv;
11684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11685 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11686 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11687 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11688 return (uint64_t)ret_conv;
11691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11692 LDKDecodeError e_conv;
11693 e_conv.inner = (void*)(e & (~1));
11694 e_conv.is_owned = (e & 1) || (e == 0);
11695 e_conv = DecodeError_clone(&e_conv);
11696 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11697 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11698 return (uint64_t)ret_conv;
11701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11702 if ((_res & 1) != 0) return;
11703 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
11705 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11709 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11710 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11711 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11712 return (uint64_t)ret_conv;
11715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11716 LDKCVec_UpdateAddHTLCZ _res_constr;
11717 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11718 if (_res_constr.datalen > 0)
11719 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11721 _res_constr.data = NULL;
11722 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11723 for (size_t p = 0; p < _res_constr.datalen; p++) {
11724 int64_t _res_conv_15 = _res_vals[p];
11725 LDKUpdateAddHTLC _res_conv_15_conv;
11726 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11727 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11728 _res_constr.data[p] = _res_conv_15_conv;
11730 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11731 CVec_UpdateAddHTLCZ_free(_res_constr);
11734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11735 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11736 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11737 if (_res_constr.datalen > 0)
11738 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11740 _res_constr.data = NULL;
11741 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11742 for (size_t t = 0; t < _res_constr.datalen; t++) {
11743 int64_t _res_conv_19 = _res_vals[t];
11744 LDKUpdateFulfillHTLC _res_conv_19_conv;
11745 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11746 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11747 _res_constr.data[t] = _res_conv_19_conv;
11749 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11750 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11754 LDKCVec_UpdateFailHTLCZ _res_constr;
11755 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11756 if (_res_constr.datalen > 0)
11757 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11759 _res_constr.data = NULL;
11760 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11761 for (size_t q = 0; q < _res_constr.datalen; q++) {
11762 int64_t _res_conv_16 = _res_vals[q];
11763 LDKUpdateFailHTLC _res_conv_16_conv;
11764 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11765 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11766 _res_constr.data[q] = _res_conv_16_conv;
11768 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11769 CVec_UpdateFailHTLCZ_free(_res_constr);
11772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11773 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11774 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11775 if (_res_constr.datalen > 0)
11776 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11778 _res_constr.data = NULL;
11779 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11780 for (size_t z = 0; z < _res_constr.datalen; z++) {
11781 int64_t _res_conv_25 = _res_vals[z];
11782 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11783 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11784 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11785 _res_constr.data[z] = _res_conv_25_conv;
11787 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11788 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11792 LDKAcceptChannel o_conv;
11793 o_conv.inner = (void*)(o & (~1));
11794 o_conv.is_owned = (o & 1) || (o == 0);
11795 o_conv = AcceptChannel_clone(&o_conv);
11796 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11797 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11798 return (uint64_t)ret_conv;
11801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11802 LDKDecodeError e_conv;
11803 e_conv.inner = (void*)(e & (~1));
11804 e_conv.is_owned = (e & 1) || (e == 0);
11805 e_conv = DecodeError_clone(&e_conv);
11806 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11807 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11808 return (uint64_t)ret_conv;
11811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11812 if ((_res & 1) != 0) return;
11813 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11815 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11819 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11820 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11821 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11822 return (uint64_t)ret_conv;
11825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11826 LDKAnnouncementSignatures o_conv;
11827 o_conv.inner = (void*)(o & (~1));
11828 o_conv.is_owned = (o & 1) || (o == 0);
11829 o_conv = AnnouncementSignatures_clone(&o_conv);
11830 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11831 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11832 return (uint64_t)ret_conv;
11835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11836 LDKDecodeError e_conv;
11837 e_conv.inner = (void*)(e & (~1));
11838 e_conv.is_owned = (e & 1) || (e == 0);
11839 e_conv = DecodeError_clone(&e_conv);
11840 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11841 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11842 return (uint64_t)ret_conv;
11845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11846 if ((_res & 1) != 0) return;
11847 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11849 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11853 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11854 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11855 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11856 return (uint64_t)ret_conv;
11859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11860 LDKChannelReestablish o_conv;
11861 o_conv.inner = (void*)(o & (~1));
11862 o_conv.is_owned = (o & 1) || (o == 0);
11863 o_conv = ChannelReestablish_clone(&o_conv);
11864 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11865 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11866 return (uint64_t)ret_conv;
11869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11870 LDKDecodeError e_conv;
11871 e_conv.inner = (void*)(e & (~1));
11872 e_conv.is_owned = (e & 1) || (e == 0);
11873 e_conv = DecodeError_clone(&e_conv);
11874 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11875 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11876 return (uint64_t)ret_conv;
11879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11880 if ((_res & 1) != 0) return;
11881 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
11883 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11887 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11888 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11889 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11890 return (uint64_t)ret_conv;
11893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11894 LDKClosingSigned o_conv;
11895 o_conv.inner = (void*)(o & (~1));
11896 o_conv.is_owned = (o & 1) || (o == 0);
11897 o_conv = ClosingSigned_clone(&o_conv);
11898 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11899 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11900 return (uint64_t)ret_conv;
11903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11904 LDKDecodeError e_conv;
11905 e_conv.inner = (void*)(e & (~1));
11906 e_conv.is_owned = (e & 1) || (e == 0);
11907 e_conv = DecodeError_clone(&e_conv);
11908 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11909 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11910 return (uint64_t)ret_conv;
11913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11914 if ((_res & 1) != 0) return;
11915 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11917 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11921 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11922 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11923 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11924 return (uint64_t)ret_conv;
11927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11928 LDKCommitmentSigned o_conv;
11929 o_conv.inner = (void*)(o & (~1));
11930 o_conv.is_owned = (o & 1) || (o == 0);
11931 o_conv = CommitmentSigned_clone(&o_conv);
11932 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11933 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11934 return (uint64_t)ret_conv;
11937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11938 LDKDecodeError e_conv;
11939 e_conv.inner = (void*)(e & (~1));
11940 e_conv.is_owned = (e & 1) || (e == 0);
11941 e_conv = DecodeError_clone(&e_conv);
11942 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11943 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11944 return (uint64_t)ret_conv;
11947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11948 if ((_res & 1) != 0) return;
11949 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11951 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11955 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11956 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11957 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11958 return (uint64_t)ret_conv;
11961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11962 LDKFundingCreated o_conv;
11963 o_conv.inner = (void*)(o & (~1));
11964 o_conv.is_owned = (o & 1) || (o == 0);
11965 o_conv = FundingCreated_clone(&o_conv);
11966 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11967 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11968 return (uint64_t)ret_conv;
11971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11972 LDKDecodeError e_conv;
11973 e_conv.inner = (void*)(e & (~1));
11974 e_conv.is_owned = (e & 1) || (e == 0);
11975 e_conv = DecodeError_clone(&e_conv);
11976 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11977 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11978 return (uint64_t)ret_conv;
11981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11982 if ((_res & 1) != 0) return;
11983 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11985 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11989 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11990 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11991 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11992 return (uint64_t)ret_conv;
11995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11996 LDKFundingSigned o_conv;
11997 o_conv.inner = (void*)(o & (~1));
11998 o_conv.is_owned = (o & 1) || (o == 0);
11999 o_conv = FundingSigned_clone(&o_conv);
12000 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12001 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12002 return (uint64_t)ret_conv;
12005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12006 LDKDecodeError e_conv;
12007 e_conv.inner = (void*)(e & (~1));
12008 e_conv.is_owned = (e & 1) || (e == 0);
12009 e_conv = DecodeError_clone(&e_conv);
12010 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12011 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12012 return (uint64_t)ret_conv;
12015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12016 if ((_res & 1) != 0) return;
12017 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12019 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12023 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12024 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12025 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12026 return (uint64_t)ret_conv;
12029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12030 LDKFundingLocked o_conv;
12031 o_conv.inner = (void*)(o & (~1));
12032 o_conv.is_owned = (o & 1) || (o == 0);
12033 o_conv = FundingLocked_clone(&o_conv);
12034 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12035 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12036 return (uint64_t)ret_conv;
12039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12040 LDKDecodeError e_conv;
12041 e_conv.inner = (void*)(e & (~1));
12042 e_conv.is_owned = (e & 1) || (e == 0);
12043 e_conv = DecodeError_clone(&e_conv);
12044 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12045 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12046 return (uint64_t)ret_conv;
12049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12050 if ((_res & 1) != 0) return;
12051 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12053 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12057 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12058 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12059 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12060 return (uint64_t)ret_conv;
12063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12065 o_conv.inner = (void*)(o & (~1));
12066 o_conv.is_owned = (o & 1) || (o == 0);
12067 o_conv = Init_clone(&o_conv);
12068 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12069 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12070 return (uint64_t)ret_conv;
12073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12074 LDKDecodeError e_conv;
12075 e_conv.inner = (void*)(e & (~1));
12076 e_conv.is_owned = (e & 1) || (e == 0);
12077 e_conv = DecodeError_clone(&e_conv);
12078 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12079 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12080 return (uint64_t)ret_conv;
12083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12084 if ((_res & 1) != 0) return;
12085 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12087 CResult_InitDecodeErrorZ_free(_res_conv);
12090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12091 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12092 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12093 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12094 return (uint64_t)ret_conv;
12097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12098 LDKOpenChannel o_conv;
12099 o_conv.inner = (void*)(o & (~1));
12100 o_conv.is_owned = (o & 1) || (o == 0);
12101 o_conv = OpenChannel_clone(&o_conv);
12102 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12103 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12104 return (uint64_t)ret_conv;
12107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12108 LDKDecodeError e_conv;
12109 e_conv.inner = (void*)(e & (~1));
12110 e_conv.is_owned = (e & 1) || (e == 0);
12111 e_conv = DecodeError_clone(&e_conv);
12112 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12113 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12114 return (uint64_t)ret_conv;
12117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12118 if ((_res & 1) != 0) return;
12119 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12121 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12125 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12126 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12127 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12128 return (uint64_t)ret_conv;
12131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12132 LDKRevokeAndACK o_conv;
12133 o_conv.inner = (void*)(o & (~1));
12134 o_conv.is_owned = (o & 1) || (o == 0);
12135 o_conv = RevokeAndACK_clone(&o_conv);
12136 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12137 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12138 return (uint64_t)ret_conv;
12141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12142 LDKDecodeError e_conv;
12143 e_conv.inner = (void*)(e & (~1));
12144 e_conv.is_owned = (e & 1) || (e == 0);
12145 e_conv = DecodeError_clone(&e_conv);
12146 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12147 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12148 return (uint64_t)ret_conv;
12151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12152 if ((_res & 1) != 0) return;
12153 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12155 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12159 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12160 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12161 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12162 return (uint64_t)ret_conv;
12165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12166 LDKShutdown o_conv;
12167 o_conv.inner = (void*)(o & (~1));
12168 o_conv.is_owned = (o & 1) || (o == 0);
12169 o_conv = Shutdown_clone(&o_conv);
12170 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12171 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12172 return (uint64_t)ret_conv;
12175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12176 LDKDecodeError e_conv;
12177 e_conv.inner = (void*)(e & (~1));
12178 e_conv.is_owned = (e & 1) || (e == 0);
12179 e_conv = DecodeError_clone(&e_conv);
12180 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12181 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12182 return (uint64_t)ret_conv;
12185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12186 if ((_res & 1) != 0) return;
12187 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12189 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12193 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12194 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12195 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12196 return (uint64_t)ret_conv;
12199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12200 LDKUpdateFailHTLC o_conv;
12201 o_conv.inner = (void*)(o & (~1));
12202 o_conv.is_owned = (o & 1) || (o == 0);
12203 o_conv = UpdateFailHTLC_clone(&o_conv);
12204 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12205 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12206 return (uint64_t)ret_conv;
12209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12210 LDKDecodeError e_conv;
12211 e_conv.inner = (void*)(e & (~1));
12212 e_conv.is_owned = (e & 1) || (e == 0);
12213 e_conv = DecodeError_clone(&e_conv);
12214 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12215 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12216 return (uint64_t)ret_conv;
12219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12220 if ((_res & 1) != 0) return;
12221 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12223 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12227 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12228 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12229 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12230 return (uint64_t)ret_conv;
12233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12234 LDKUpdateFailMalformedHTLC o_conv;
12235 o_conv.inner = (void*)(o & (~1));
12236 o_conv.is_owned = (o & 1) || (o == 0);
12237 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12238 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12239 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12240 return (uint64_t)ret_conv;
12243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12244 LDKDecodeError e_conv;
12245 e_conv.inner = (void*)(e & (~1));
12246 e_conv.is_owned = (e & 1) || (e == 0);
12247 e_conv = DecodeError_clone(&e_conv);
12248 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12249 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12250 return (uint64_t)ret_conv;
12253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12254 if ((_res & 1) != 0) return;
12255 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12257 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12261 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12262 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12263 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12264 return (uint64_t)ret_conv;
12267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12268 LDKUpdateFee o_conv;
12269 o_conv.inner = (void*)(o & (~1));
12270 o_conv.is_owned = (o & 1) || (o == 0);
12271 o_conv = UpdateFee_clone(&o_conv);
12272 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12273 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12274 return (uint64_t)ret_conv;
12277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12278 LDKDecodeError e_conv;
12279 e_conv.inner = (void*)(e & (~1));
12280 e_conv.is_owned = (e & 1) || (e == 0);
12281 e_conv = DecodeError_clone(&e_conv);
12282 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12283 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12284 return (uint64_t)ret_conv;
12287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12288 if ((_res & 1) != 0) return;
12289 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12291 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12295 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12296 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12297 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12298 return (uint64_t)ret_conv;
12301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12302 LDKUpdateFulfillHTLC o_conv;
12303 o_conv.inner = (void*)(o & (~1));
12304 o_conv.is_owned = (o & 1) || (o == 0);
12305 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12306 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12307 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12308 return (uint64_t)ret_conv;
12311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12312 LDKDecodeError e_conv;
12313 e_conv.inner = (void*)(e & (~1));
12314 e_conv.is_owned = (e & 1) || (e == 0);
12315 e_conv = DecodeError_clone(&e_conv);
12316 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12317 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12318 return (uint64_t)ret_conv;
12321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12322 if ((_res & 1) != 0) return;
12323 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12325 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12329 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12330 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12331 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12332 return (uint64_t)ret_conv;
12335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12336 LDKUpdateAddHTLC o_conv;
12337 o_conv.inner = (void*)(o & (~1));
12338 o_conv.is_owned = (o & 1) || (o == 0);
12339 o_conv = UpdateAddHTLC_clone(&o_conv);
12340 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12341 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12342 return (uint64_t)ret_conv;
12345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12346 LDKDecodeError e_conv;
12347 e_conv.inner = (void*)(e & (~1));
12348 e_conv.is_owned = (e & 1) || (e == 0);
12349 e_conv = DecodeError_clone(&e_conv);
12350 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12351 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12352 return (uint64_t)ret_conv;
12355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12356 if ((_res & 1) != 0) return;
12357 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12359 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12363 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12364 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12365 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12366 return (uint64_t)ret_conv;
12369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12371 o_conv.inner = (void*)(o & (~1));
12372 o_conv.is_owned = (o & 1) || (o == 0);
12373 o_conv = Ping_clone(&o_conv);
12374 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12375 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12376 return (uint64_t)ret_conv;
12379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12380 LDKDecodeError e_conv;
12381 e_conv.inner = (void*)(e & (~1));
12382 e_conv.is_owned = (e & 1) || (e == 0);
12383 e_conv = DecodeError_clone(&e_conv);
12384 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12385 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12386 return (uint64_t)ret_conv;
12389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12390 if ((_res & 1) != 0) return;
12391 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12393 CResult_PingDecodeErrorZ_free(_res_conv);
12396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12397 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12398 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12399 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12400 return (uint64_t)ret_conv;
12403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12405 o_conv.inner = (void*)(o & (~1));
12406 o_conv.is_owned = (o & 1) || (o == 0);
12407 o_conv = Pong_clone(&o_conv);
12408 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12409 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12410 return (uint64_t)ret_conv;
12413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12414 LDKDecodeError e_conv;
12415 e_conv.inner = (void*)(e & (~1));
12416 e_conv.is_owned = (e & 1) || (e == 0);
12417 e_conv = DecodeError_clone(&e_conv);
12418 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12419 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12420 return (uint64_t)ret_conv;
12423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12424 if ((_res & 1) != 0) return;
12425 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12427 CResult_PongDecodeErrorZ_free(_res_conv);
12430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12431 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12432 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12433 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12434 return (uint64_t)ret_conv;
12437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12438 LDKUnsignedChannelAnnouncement o_conv;
12439 o_conv.inner = (void*)(o & (~1));
12440 o_conv.is_owned = (o & 1) || (o == 0);
12441 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12442 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12443 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12444 return (uint64_t)ret_conv;
12447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12448 LDKDecodeError e_conv;
12449 e_conv.inner = (void*)(e & (~1));
12450 e_conv.is_owned = (e & 1) || (e == 0);
12451 e_conv = DecodeError_clone(&e_conv);
12452 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12453 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12454 return (uint64_t)ret_conv;
12457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12458 if ((_res & 1) != 0) return;
12459 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12461 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12465 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12466 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12467 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12468 return (uint64_t)ret_conv;
12471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12472 LDKChannelAnnouncement o_conv;
12473 o_conv.inner = (void*)(o & (~1));
12474 o_conv.is_owned = (o & 1) || (o == 0);
12475 o_conv = ChannelAnnouncement_clone(&o_conv);
12476 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12477 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12478 return (uint64_t)ret_conv;
12481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12482 LDKDecodeError e_conv;
12483 e_conv.inner = (void*)(e & (~1));
12484 e_conv.is_owned = (e & 1) || (e == 0);
12485 e_conv = DecodeError_clone(&e_conv);
12486 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12487 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12488 return (uint64_t)ret_conv;
12491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12492 if ((_res & 1) != 0) return;
12493 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12495 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12499 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12500 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12501 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12502 return (uint64_t)ret_conv;
12505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12506 LDKUnsignedChannelUpdate o_conv;
12507 o_conv.inner = (void*)(o & (~1));
12508 o_conv.is_owned = (o & 1) || (o == 0);
12509 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12510 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12511 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12512 return (uint64_t)ret_conv;
12515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12516 LDKDecodeError e_conv;
12517 e_conv.inner = (void*)(e & (~1));
12518 e_conv.is_owned = (e & 1) || (e == 0);
12519 e_conv = DecodeError_clone(&e_conv);
12520 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12521 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12522 return (uint64_t)ret_conv;
12525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12526 if ((_res & 1) != 0) return;
12527 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12529 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12533 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12534 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12535 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12536 return (uint64_t)ret_conv;
12539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12540 LDKChannelUpdate o_conv;
12541 o_conv.inner = (void*)(o & (~1));
12542 o_conv.is_owned = (o & 1) || (o == 0);
12543 o_conv = ChannelUpdate_clone(&o_conv);
12544 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12545 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12546 return (uint64_t)ret_conv;
12549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12550 LDKDecodeError e_conv;
12551 e_conv.inner = (void*)(e & (~1));
12552 e_conv.is_owned = (e & 1) || (e == 0);
12553 e_conv = DecodeError_clone(&e_conv);
12554 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12555 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12556 return (uint64_t)ret_conv;
12559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12560 if ((_res & 1) != 0) return;
12561 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12563 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12567 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12568 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12569 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12570 return (uint64_t)ret_conv;
12573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12574 LDKErrorMessage o_conv;
12575 o_conv.inner = (void*)(o & (~1));
12576 o_conv.is_owned = (o & 1) || (o == 0);
12577 o_conv = ErrorMessage_clone(&o_conv);
12578 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12579 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12580 return (uint64_t)ret_conv;
12583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12584 LDKDecodeError e_conv;
12585 e_conv.inner = (void*)(e & (~1));
12586 e_conv.is_owned = (e & 1) || (e == 0);
12587 e_conv = DecodeError_clone(&e_conv);
12588 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12589 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12590 return (uint64_t)ret_conv;
12593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12594 if ((_res & 1) != 0) return;
12595 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12597 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12601 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12602 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12603 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12604 return (uint64_t)ret_conv;
12607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12608 LDKUnsignedNodeAnnouncement o_conv;
12609 o_conv.inner = (void*)(o & (~1));
12610 o_conv.is_owned = (o & 1) || (o == 0);
12611 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12612 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12613 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12614 return (uint64_t)ret_conv;
12617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12618 LDKDecodeError e_conv;
12619 e_conv.inner = (void*)(e & (~1));
12620 e_conv.is_owned = (e & 1) || (e == 0);
12621 e_conv = DecodeError_clone(&e_conv);
12622 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12623 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12624 return (uint64_t)ret_conv;
12627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12628 if ((_res & 1) != 0) return;
12629 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12631 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12635 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12636 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12637 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12638 return (uint64_t)ret_conv;
12641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12642 LDKNodeAnnouncement o_conv;
12643 o_conv.inner = (void*)(o & (~1));
12644 o_conv.is_owned = (o & 1) || (o == 0);
12645 o_conv = NodeAnnouncement_clone(&o_conv);
12646 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12647 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12648 return (uint64_t)ret_conv;
12651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12652 LDKDecodeError e_conv;
12653 e_conv.inner = (void*)(e & (~1));
12654 e_conv.is_owned = (e & 1) || (e == 0);
12655 e_conv = DecodeError_clone(&e_conv);
12656 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12657 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12658 return (uint64_t)ret_conv;
12661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12662 if ((_res & 1) != 0) return;
12663 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12665 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12669 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12670 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12671 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12672 return (uint64_t)ret_conv;
12675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12676 LDKQueryShortChannelIds o_conv;
12677 o_conv.inner = (void*)(o & (~1));
12678 o_conv.is_owned = (o & 1) || (o == 0);
12679 o_conv = QueryShortChannelIds_clone(&o_conv);
12680 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12681 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12682 return (uint64_t)ret_conv;
12685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12686 LDKDecodeError e_conv;
12687 e_conv.inner = (void*)(e & (~1));
12688 e_conv.is_owned = (e & 1) || (e == 0);
12689 e_conv = DecodeError_clone(&e_conv);
12690 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12691 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12692 return (uint64_t)ret_conv;
12695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12696 if ((_res & 1) != 0) return;
12697 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12699 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12703 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12704 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12705 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12706 return (uint64_t)ret_conv;
12709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12710 LDKReplyShortChannelIdsEnd o_conv;
12711 o_conv.inner = (void*)(o & (~1));
12712 o_conv.is_owned = (o & 1) || (o == 0);
12713 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12714 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12715 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12716 return (uint64_t)ret_conv;
12719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12720 LDKDecodeError e_conv;
12721 e_conv.inner = (void*)(e & (~1));
12722 e_conv.is_owned = (e & 1) || (e == 0);
12723 e_conv = DecodeError_clone(&e_conv);
12724 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12725 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12726 return (uint64_t)ret_conv;
12729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12730 if ((_res & 1) != 0) return;
12731 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
12733 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12737 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12738 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12739 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12740 return (uint64_t)ret_conv;
12743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12744 LDKQueryChannelRange o_conv;
12745 o_conv.inner = (void*)(o & (~1));
12746 o_conv.is_owned = (o & 1) || (o == 0);
12747 o_conv = QueryChannelRange_clone(&o_conv);
12748 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12749 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12750 return (uint64_t)ret_conv;
12753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12754 LDKDecodeError e_conv;
12755 e_conv.inner = (void*)(e & (~1));
12756 e_conv.is_owned = (e & 1) || (e == 0);
12757 e_conv = DecodeError_clone(&e_conv);
12758 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12759 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12760 return (uint64_t)ret_conv;
12763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12764 if ((_res & 1) != 0) return;
12765 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12767 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12771 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12772 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12773 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12774 return (uint64_t)ret_conv;
12777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12778 LDKReplyChannelRange o_conv;
12779 o_conv.inner = (void*)(o & (~1));
12780 o_conv.is_owned = (o & 1) || (o == 0);
12781 o_conv = ReplyChannelRange_clone(&o_conv);
12782 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12783 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12784 return (uint64_t)ret_conv;
12787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12788 LDKDecodeError e_conv;
12789 e_conv.inner = (void*)(e & (~1));
12790 e_conv.is_owned = (e & 1) || (e == 0);
12791 e_conv = DecodeError_clone(&e_conv);
12792 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12793 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12794 return (uint64_t)ret_conv;
12797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12798 if ((_res & 1) != 0) return;
12799 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12801 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12805 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12806 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12807 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12808 return (uint64_t)ret_conv;
12811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12812 LDKGossipTimestampFilter o_conv;
12813 o_conv.inner = (void*)(o & (~1));
12814 o_conv.is_owned = (o & 1) || (o == 0);
12815 o_conv = GossipTimestampFilter_clone(&o_conv);
12816 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12817 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12818 return (uint64_t)ret_conv;
12821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12822 LDKDecodeError e_conv;
12823 e_conv.inner = (void*)(e & (~1));
12824 e_conv.is_owned = (e & 1) || (e == 0);
12825 e_conv = DecodeError_clone(&e_conv);
12826 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12827 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12828 return (uint64_t)ret_conv;
12831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12832 if ((_res & 1) != 0) return;
12833 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
12835 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12839 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12840 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12841 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12842 return (uint64_t)ret_conv;
12845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12847 o_conv.inner = (void*)(o & (~1));
12848 o_conv.is_owned = (o & 1) || (o == 0);
12849 o_conv = Invoice_clone(&o_conv);
12850 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12851 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12852 return (uint64_t)ret_conv;
12855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12856 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
12857 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12858 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12859 return (uint64_t)ret_conv;
12862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12863 if ((_res & 1) != 0) return;
12864 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
12866 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12870 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12871 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12872 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12873 return (uint64_t)ret_conv;
12876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12877 if ((this_ptr & 1) != 0) return;
12878 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12879 FREE((void*)this_ptr);
12880 Event_free(this_ptr_conv);
12883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12884 LDKEvent* orig_conv = (LDKEvent*)orig;
12885 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12886 *ret_copy = Event_clone(orig_conv);
12887 uint64_t ret_ref = (uint64_t)ret_copy;
12891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
12892 LDKEvent* obj_conv = (LDKEvent*)obj;
12893 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12894 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12895 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12896 CVec_u8Z_free(ret_var);
12900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12901 if ((this_ptr & 1) != 0) return;
12902 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12903 FREE((void*)this_ptr);
12904 MessageSendEvent_free(this_ptr_conv);
12907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12908 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12909 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12910 *ret_copy = MessageSendEvent_clone(orig_conv);
12911 uint64_t ret_ref = (uint64_t)ret_copy;
12915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12916 if ((this_ptr & 1) != 0) return;
12917 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12918 FREE((void*)this_ptr);
12919 MessageSendEventsProvider_free(this_ptr_conv);
12922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12923 if ((this_ptr & 1) != 0) return;
12924 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12925 FREE((void*)this_ptr);
12926 EventsProvider_free(this_ptr_conv);
12929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12930 if ((this_ptr & 1) != 0) return;
12931 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12932 FREE((void*)this_ptr);
12933 EventHandler_free(this_ptr_conv);
12936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12937 if ((this_ptr & 1) != 0) return;
12938 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12939 FREE((void*)this_ptr);
12940 APIError_free(this_ptr_conv);
12943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12944 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12945 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12946 *ret_copy = APIError_clone(orig_conv);
12947 uint64_t ret_ref = (uint64_t)ret_copy;
12951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
12952 LDKu8slice msg_ref;
12953 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12954 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12955 LDKSecretKey sk_ref;
12956 CHECK((*env)->GetArrayLength(env, sk) == 32);
12957 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
12958 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12959 *ret_conv = sign(msg_ref, sk_ref);
12960 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12961 return (uint64_t)ret_conv;
12964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
12965 LDKu8slice msg_ref;
12966 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12967 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12968 LDKStr sig_conv = java_to_owned_str(env, sig);
12969 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12970 *ret_conv = recover_pk(msg_ref, sig_conv);
12971 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12972 return (uint64_t)ret_conv;
12975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
12976 LDKu8slice msg_ref;
12977 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12978 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12979 LDKStr sig_conv = java_to_owned_str(env, sig);
12980 LDKPublicKey pk_ref;
12981 CHECK((*env)->GetArrayLength(env, pk) == 33);
12982 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
12983 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12984 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12988 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12989 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12990 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
12994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
12995 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12996 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12997 jboolean ret_val = Level_eq(a_conv, b_conv);
13001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13002 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13003 int64_t ret_val = Level_hash(o_conv);
13007 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13008 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13013 if ((this_ptr & 1) != 0) return;
13014 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13015 FREE((void*)this_ptr);
13016 Logger_free(this_ptr_conv);
13019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13020 LDKChannelHandshakeConfig this_obj_conv;
13021 this_obj_conv.inner = (void*)(this_obj & (~1));
13022 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13023 ChannelHandshakeConfig_free(this_obj_conv);
13026 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13027 LDKChannelHandshakeConfig this_ptr_conv;
13028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13029 this_ptr_conv.is_owned = false;
13030 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13035 LDKChannelHandshakeConfig this_ptr_conv;
13036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13037 this_ptr_conv.is_owned = false;
13038 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13041 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13042 LDKChannelHandshakeConfig this_ptr_conv;
13043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13044 this_ptr_conv.is_owned = false;
13045 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13049 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) {
13050 LDKChannelHandshakeConfig this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = false;
13053 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13057 LDKChannelHandshakeConfig this_ptr_conv;
13058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13059 this_ptr_conv.is_owned = false;
13060 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13064 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) {
13065 LDKChannelHandshakeConfig this_ptr_conv;
13066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13067 this_ptr_conv.is_owned = false;
13068 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13071 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) {
13072 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13075 uint64_t ret_ref = (uint64_t)ret_var.inner;
13076 if (ret_var.is_owned) {
13082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13083 LDKChannelHandshakeConfig orig_conv;
13084 orig_conv.inner = (void*)(orig & (~1));
13085 orig_conv.is_owned = false;
13086 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13089 uint64_t ret_ref = (uint64_t)ret_var.inner;
13090 if (ret_var.is_owned) {
13096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13097 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13100 uint64_t ret_ref = (uint64_t)ret_var.inner;
13101 if (ret_var.is_owned) {
13107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13108 LDKChannelHandshakeLimits this_obj_conv;
13109 this_obj_conv.inner = (void*)(this_obj & (~1));
13110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13111 ChannelHandshakeLimits_free(this_obj_conv);
13114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13115 LDKChannelHandshakeLimits this_ptr_conv;
13116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13117 this_ptr_conv.is_owned = false;
13118 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13123 LDKChannelHandshakeLimits this_ptr_conv;
13124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13125 this_ptr_conv.is_owned = false;
13126 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13130 LDKChannelHandshakeLimits this_ptr_conv;
13131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13132 this_ptr_conv.is_owned = false;
13133 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13137 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) {
13138 LDKChannelHandshakeLimits this_ptr_conv;
13139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13140 this_ptr_conv.is_owned = false;
13141 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13144 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) {
13145 LDKChannelHandshakeLimits this_ptr_conv;
13146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13147 this_ptr_conv.is_owned = false;
13148 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13152 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) {
13153 LDKChannelHandshakeLimits this_ptr_conv;
13154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13155 this_ptr_conv.is_owned = false;
13156 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13160 LDKChannelHandshakeLimits this_ptr_conv;
13161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13162 this_ptr_conv.is_owned = false;
13163 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13167 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) {
13168 LDKChannelHandshakeLimits this_ptr_conv;
13169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13170 this_ptr_conv.is_owned = false;
13171 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13174 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13175 LDKChannelHandshakeLimits this_ptr_conv;
13176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13177 this_ptr_conv.is_owned = false;
13178 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13182 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) {
13183 LDKChannelHandshakeLimits this_ptr_conv;
13184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13185 this_ptr_conv.is_owned = false;
13186 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13189 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13190 LDKChannelHandshakeLimits this_ptr_conv;
13191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13192 this_ptr_conv.is_owned = false;
13193 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13198 LDKChannelHandshakeLimits this_ptr_conv;
13199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13200 this_ptr_conv.is_owned = false;
13201 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13205 LDKChannelHandshakeLimits this_ptr_conv;
13206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13207 this_ptr_conv.is_owned = false;
13208 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13213 LDKChannelHandshakeLimits this_ptr_conv;
13214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13215 this_ptr_conv.is_owned = false;
13216 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13219 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13220 LDKChannelHandshakeLimits this_ptr_conv;
13221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13222 this_ptr_conv.is_owned = false;
13223 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13227 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) {
13228 LDKChannelHandshakeLimits this_ptr_conv;
13229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13230 this_ptr_conv.is_owned = false;
13231 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13234 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) {
13235 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);
13236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13238 uint64_t ret_ref = (uint64_t)ret_var.inner;
13239 if (ret_var.is_owned) {
13245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13246 LDKChannelHandshakeLimits orig_conv;
13247 orig_conv.inner = (void*)(orig & (~1));
13248 orig_conv.is_owned = false;
13249 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13252 uint64_t ret_ref = (uint64_t)ret_var.inner;
13253 if (ret_var.is_owned) {
13259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13260 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13263 uint64_t ret_ref = (uint64_t)ret_var.inner;
13264 if (ret_var.is_owned) {
13270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13271 LDKChannelConfig this_obj_conv;
13272 this_obj_conv.inner = (void*)(this_obj & (~1));
13273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13274 ChannelConfig_free(this_obj_conv);
13277 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13278 LDKChannelConfig this_ptr_conv;
13279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13280 this_ptr_conv.is_owned = false;
13281 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13286 LDKChannelConfig this_ptr_conv;
13287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13288 this_ptr_conv.is_owned = false;
13289 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13292 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13293 LDKChannelConfig this_ptr_conv;
13294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13295 this_ptr_conv.is_owned = false;
13296 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13301 LDKChannelConfig this_ptr_conv;
13302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13303 this_ptr_conv.is_owned = false;
13304 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13308 LDKChannelConfig this_ptr_conv;
13309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13310 this_ptr_conv.is_owned = false;
13311 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13316 LDKChannelConfig this_ptr_conv;
13317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13318 this_ptr_conv.is_owned = false;
13319 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13323 LDKChannelConfig this_ptr_conv;
13324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13325 this_ptr_conv.is_owned = false;
13326 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13331 LDKChannelConfig this_ptr_conv;
13332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13333 this_ptr_conv.is_owned = false;
13334 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13338 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13341 uint64_t ret_ref = (uint64_t)ret_var.inner;
13342 if (ret_var.is_owned) {
13348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13349 LDKChannelConfig orig_conv;
13350 orig_conv.inner = (void*)(orig & (~1));
13351 orig_conv.is_owned = false;
13352 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13355 uint64_t ret_ref = (uint64_t)ret_var.inner;
13356 if (ret_var.is_owned) {
13362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13363 LDKChannelConfig ret_var = ChannelConfig_default();
13364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13366 uint64_t ret_ref = (uint64_t)ret_var.inner;
13367 if (ret_var.is_owned) {
13373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13374 LDKChannelConfig obj_conv;
13375 obj_conv.inner = (void*)(obj & (~1));
13376 obj_conv.is_owned = false;
13377 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13378 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13379 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13380 CVec_u8Z_free(ret_var);
13384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13385 LDKu8slice ser_ref;
13386 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13387 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13388 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13389 *ret_conv = ChannelConfig_read(ser_ref);
13390 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13391 return (uint64_t)ret_conv;
13394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13395 LDKUserConfig this_obj_conv;
13396 this_obj_conv.inner = (void*)(this_obj & (~1));
13397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13398 UserConfig_free(this_obj_conv);
13401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13402 LDKUserConfig this_ptr_conv;
13403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13404 this_ptr_conv.is_owned = false;
13405 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13408 uint64_t ret_ref = (uint64_t)ret_var.inner;
13409 if (ret_var.is_owned) {
13415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13416 LDKUserConfig this_ptr_conv;
13417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13418 this_ptr_conv.is_owned = false;
13419 LDKChannelHandshakeConfig val_conv;
13420 val_conv.inner = (void*)(val & (~1));
13421 val_conv.is_owned = (val & 1) || (val == 0);
13422 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13423 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13427 LDKUserConfig this_ptr_conv;
13428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13429 this_ptr_conv.is_owned = false;
13430 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13433 uint64_t ret_ref = (uint64_t)ret_var.inner;
13434 if (ret_var.is_owned) {
13440 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) {
13441 LDKUserConfig this_ptr_conv;
13442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13443 this_ptr_conv.is_owned = false;
13444 LDKChannelHandshakeLimits val_conv;
13445 val_conv.inner = (void*)(val & (~1));
13446 val_conv.is_owned = (val & 1) || (val == 0);
13447 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13448 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13452 LDKUserConfig this_ptr_conv;
13453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13454 this_ptr_conv.is_owned = false;
13455 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13458 uint64_t ret_ref = (uint64_t)ret_var.inner;
13459 if (ret_var.is_owned) {
13465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13466 LDKUserConfig this_ptr_conv;
13467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13468 this_ptr_conv.is_owned = false;
13469 LDKChannelConfig val_conv;
13470 val_conv.inner = (void*)(val & (~1));
13471 val_conv.is_owned = (val & 1) || (val == 0);
13472 val_conv = ChannelConfig_clone(&val_conv);
13473 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13476 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) {
13477 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13478 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13479 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13480 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13481 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13482 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13483 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13484 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13485 LDKChannelConfig channel_options_arg_conv;
13486 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13487 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13488 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13489 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13492 uint64_t ret_ref = (uint64_t)ret_var.inner;
13493 if (ret_var.is_owned) {
13499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13500 LDKUserConfig orig_conv;
13501 orig_conv.inner = (void*)(orig & (~1));
13502 orig_conv.is_owned = false;
13503 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13506 uint64_t ret_ref = (uint64_t)ret_var.inner;
13507 if (ret_var.is_owned) {
13513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13514 LDKUserConfig ret_var = UserConfig_default();
13515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13517 uint64_t ret_ref = (uint64_t)ret_var.inner;
13518 if (ret_var.is_owned) {
13524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13525 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13526 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13531 if ((this_ptr & 1) != 0) return;
13532 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13533 FREE((void*)this_ptr);
13534 Access_free(this_ptr_conv);
13537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13538 if ((this_ptr & 1) != 0) return;
13539 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13540 FREE((void*)this_ptr);
13541 Listen_free(this_ptr_conv);
13544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13545 if ((this_ptr & 1) != 0) return;
13546 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13547 FREE((void*)this_ptr);
13548 Confirm_free(this_ptr_conv);
13551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13552 if ((this_ptr & 1) != 0) return;
13553 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13554 FREE((void*)this_ptr);
13555 Watch_free(this_ptr_conv);
13558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13559 if ((this_ptr & 1) != 0) return;
13560 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13561 FREE((void*)this_ptr);
13562 Filter_free(this_ptr_conv);
13565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13566 LDKWatchedOutput this_obj_conv;
13567 this_obj_conv.inner = (void*)(this_obj & (~1));
13568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13569 WatchedOutput_free(this_obj_conv);
13572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13573 LDKWatchedOutput this_ptr_conv;
13574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13575 this_ptr_conv.is_owned = false;
13576 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13577 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13582 LDKWatchedOutput this_ptr_conv;
13583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13584 this_ptr_conv.is_owned = false;
13585 LDKThirtyTwoBytes val_ref;
13586 CHECK((*env)->GetArrayLength(env, val) == 32);
13587 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13588 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13592 LDKWatchedOutput this_ptr_conv;
13593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13594 this_ptr_conv.is_owned = false;
13595 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13598 uint64_t ret_ref = (uint64_t)ret_var.inner;
13599 if (ret_var.is_owned) {
13605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13606 LDKWatchedOutput this_ptr_conv;
13607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13608 this_ptr_conv.is_owned = false;
13609 LDKOutPoint val_conv;
13610 val_conv.inner = (void*)(val & (~1));
13611 val_conv.is_owned = (val & 1) || (val == 0);
13612 val_conv = OutPoint_clone(&val_conv);
13613 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13617 LDKWatchedOutput this_ptr_conv;
13618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13619 this_ptr_conv.is_owned = false;
13620 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13621 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13622 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13627 LDKWatchedOutput this_ptr_conv;
13628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13629 this_ptr_conv.is_owned = false;
13630 LDKCVec_u8Z val_ref;
13631 val_ref.datalen = (*env)->GetArrayLength(env, val);
13632 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13633 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13634 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13637 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) {
13638 LDKThirtyTwoBytes block_hash_arg_ref;
13639 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13640 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13641 LDKOutPoint outpoint_arg_conv;
13642 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13643 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13644 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13645 LDKCVec_u8Z script_pubkey_arg_ref;
13646 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13647 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13648 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13649 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13652 uint64_t ret_ref = (uint64_t)ret_var.inner;
13653 if (ret_var.is_owned) {
13659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13660 LDKWatchedOutput orig_conv;
13661 orig_conv.inner = (void*)(orig & (~1));
13662 orig_conv.is_owned = false;
13663 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13666 uint64_t ret_ref = (uint64_t)ret_var.inner;
13667 if (ret_var.is_owned) {
13673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13674 LDKWatchedOutput o_conv;
13675 o_conv.inner = (void*)(o & (~1));
13676 o_conv.is_owned = false;
13677 int64_t ret_val = WatchedOutput_hash(&o_conv);
13681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13682 if ((this_ptr & 1) != 0) return;
13683 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13684 FREE((void*)this_ptr);
13685 BroadcasterInterface_free(this_ptr_conv);
13688 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13689 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13690 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13695 if ((this_ptr & 1) != 0) return;
13696 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13697 FREE((void*)this_ptr);
13698 FeeEstimator_free(this_ptr_conv);
13701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13702 LDKChainMonitor this_obj_conv;
13703 this_obj_conv.inner = (void*)(this_obj & (~1));
13704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13705 ChainMonitor_free(this_obj_conv);
13708 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) {
13709 LDKFilter *chain_source_conv_ptr = NULL;
13710 if (chain_source != 0) {
13711 LDKFilter chain_source_conv;
13712 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
13713 if (chain_source_conv.free == LDKFilter_JCalls_free) {
13714 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13715 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
13717 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13718 *chain_source_conv_ptr = chain_source_conv;
13720 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13721 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
13722 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13723 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
13725 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13726 if (logger_conv.free == LDKLogger_JCalls_free) {
13727 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13728 LDKLogger_JCalls_clone(logger_conv.this_arg);
13730 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13731 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
13732 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13733 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
13735 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13736 if (persister_conv.free == LDKPersist_JCalls_free) {
13737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13738 LDKPersist_JCalls_clone(persister_conv.this_arg);
13740 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13743 uint64_t ret_ref = (uint64_t)ret_var.inner;
13744 if (ret_var.is_owned) {
13750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
13751 LDKChainMonitor this_arg_conv;
13752 this_arg_conv.inner = (void*)(this_arg & (~1));
13753 this_arg_conv.is_owned = false;
13754 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
13755 *ret = ChainMonitor_as_Listen(&this_arg_conv);
13756 return (uint64_t)ret;
13759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
13760 LDKChainMonitor this_arg_conv;
13761 this_arg_conv.inner = (void*)(this_arg & (~1));
13762 this_arg_conv.is_owned = false;
13763 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13764 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
13765 return (uint64_t)ret;
13768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13769 LDKChainMonitor this_arg_conv;
13770 this_arg_conv.inner = (void*)(this_arg & (~1));
13771 this_arg_conv.is_owned = false;
13772 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
13773 *ret = ChainMonitor_as_Watch(&this_arg_conv);
13774 return (uint64_t)ret;
13777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
13778 LDKChainMonitor this_arg_conv;
13779 this_arg_conv.inner = (void*)(this_arg & (~1));
13780 this_arg_conv.is_owned = false;
13781 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13782 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13783 return (uint64_t)ret;
13786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13787 LDKChannelMonitorUpdate this_obj_conv;
13788 this_obj_conv.inner = (void*)(this_obj & (~1));
13789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13790 ChannelMonitorUpdate_free(this_obj_conv);
13793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13794 LDKChannelMonitorUpdate this_ptr_conv;
13795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13796 this_ptr_conv.is_owned = false;
13797 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13802 LDKChannelMonitorUpdate this_ptr_conv;
13803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13804 this_ptr_conv.is_owned = false;
13805 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13809 LDKChannelMonitorUpdate orig_conv;
13810 orig_conv.inner = (void*)(orig & (~1));
13811 orig_conv.is_owned = false;
13812 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13815 uint64_t ret_ref = (uint64_t)ret_var.inner;
13816 if (ret_var.is_owned) {
13822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13823 LDKChannelMonitorUpdate obj_conv;
13824 obj_conv.inner = (void*)(obj & (~1));
13825 obj_conv.is_owned = false;
13826 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13827 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13828 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13829 CVec_u8Z_free(ret_var);
13833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13834 LDKu8slice ser_ref;
13835 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13836 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13837 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13838 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13839 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13840 return (uint64_t)ret_conv;
13843 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13844 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13845 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
13849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13850 LDKMonitorUpdateError this_obj_conv;
13851 this_obj_conv.inner = (void*)(this_obj & (~1));
13852 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13853 MonitorUpdateError_free(this_obj_conv);
13856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13857 LDKMonitorUpdateError orig_conv;
13858 orig_conv.inner = (void*)(orig & (~1));
13859 orig_conv.is_owned = false;
13860 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13863 uint64_t ret_ref = (uint64_t)ret_var.inner;
13864 if (ret_var.is_owned) {
13870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13871 if ((this_ptr & 1) != 0) return;
13872 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13873 FREE((void*)this_ptr);
13874 MonitorEvent_free(this_ptr_conv);
13877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13878 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13879 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13880 *ret_copy = MonitorEvent_clone(orig_conv);
13881 uint64_t ret_ref = (uint64_t)ret_copy;
13885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13886 LDKHTLCUpdate this_obj_conv;
13887 this_obj_conv.inner = (void*)(this_obj & (~1));
13888 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13889 HTLCUpdate_free(this_obj_conv);
13892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13893 LDKHTLCUpdate orig_conv;
13894 orig_conv.inner = (void*)(orig & (~1));
13895 orig_conv.is_owned = false;
13896 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13899 uint64_t ret_ref = (uint64_t)ret_var.inner;
13900 if (ret_var.is_owned) {
13906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13907 LDKHTLCUpdate obj_conv;
13908 obj_conv.inner = (void*)(obj & (~1));
13909 obj_conv.is_owned = false;
13910 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13911 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13912 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13913 CVec_u8Z_free(ret_var);
13917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13918 LDKu8slice ser_ref;
13919 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13920 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13921 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13922 *ret_conv = HTLCUpdate_read(ser_ref);
13923 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13924 return (uint64_t)ret_conv;
13927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13928 LDKChannelMonitor this_obj_conv;
13929 this_obj_conv.inner = (void*)(this_obj & (~1));
13930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13931 ChannelMonitor_free(this_obj_conv);
13934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13935 LDKChannelMonitor orig_conv;
13936 orig_conv.inner = (void*)(orig & (~1));
13937 orig_conv.is_owned = false;
13938 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13941 uint64_t ret_ref = (uint64_t)ret_var.inner;
13942 if (ret_var.is_owned) {
13948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
13949 LDKChannelMonitor obj_conv;
13950 obj_conv.inner = (void*)(obj & (~1));
13951 obj_conv.is_owned = false;
13952 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13953 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13954 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13955 CVec_u8Z_free(ret_var);
13959 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) {
13960 LDKChannelMonitor this_arg_conv;
13961 this_arg_conv.inner = (void*)(this_arg & (~1));
13962 this_arg_conv.is_owned = false;
13963 LDKChannelMonitorUpdate updates_conv;
13964 updates_conv.inner = (void*)(updates & (~1));
13965 updates_conv.is_owned = false;
13966 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13967 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13968 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13969 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13970 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13971 return (uint64_t)ret_conv;
13974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13975 LDKChannelMonitor this_arg_conv;
13976 this_arg_conv.inner = (void*)(this_arg & (~1));
13977 this_arg_conv.is_owned = false;
13978 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
13983 LDKChannelMonitor this_arg_conv;
13984 this_arg_conv.inner = (void*)(this_arg & (~1));
13985 this_arg_conv.is_owned = false;
13986 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13987 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13988 return (uint64_t)ret_ref;
13991 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13992 LDKChannelMonitor this_arg_conv;
13993 this_arg_conv.inner = (void*)(this_arg & (~1));
13994 this_arg_conv.is_owned = false;
13995 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13996 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13997 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13998 for (size_t v = 0; v < ret_var.datalen; v++) {
13999 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14000 *ret_conv_47_ref = ret_var.data[v];
14001 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14003 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14004 FREE(ret_var.data);
14008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14009 LDKChannelMonitor this_arg_conv;
14010 this_arg_conv.inner = (void*)(this_arg & (~1));
14011 this_arg_conv.is_owned = false;
14012 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14013 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14016 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14017 LDKChannelMonitor this_arg_conv;
14018 this_arg_conv.inner = (void*)(this_arg & (~1));
14019 this_arg_conv.is_owned = false;
14020 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14021 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14022 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14023 for (size_t o = 0; o < ret_var.datalen; o++) {
14024 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14025 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14026 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14027 ret_arr_ptr[o] = ret_conv_14_ref;
14029 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14030 FREE(ret_var.data);
14034 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14035 LDKChannelMonitor this_arg_conv;
14036 this_arg_conv.inner = (void*)(this_arg & (~1));
14037 this_arg_conv.is_owned = false;
14038 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14039 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14040 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14041 for (size_t h = 0; h < ret_var.datalen; h++) {
14042 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14043 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14044 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14045 ret_arr_ptr[h] = ret_conv_7_ref;
14047 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14048 FREE(ret_var.data);
14052 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) {
14053 LDKChannelMonitor this_arg_conv;
14054 this_arg_conv.inner = (void*)(this_arg & (~1));
14055 this_arg_conv.is_owned = false;
14056 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14057 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14058 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14060 for (size_t i = 0; i < ret_var.datalen; i++) {
14061 LDKTransaction ret_conv_8_var = ret_var.data[i];
14062 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14063 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14064 Transaction_free(ret_conv_8_var);
14065 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14067 FREE(ret_var.data);
14071 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) {
14072 LDKChannelMonitor this_arg_conv;
14073 this_arg_conv.inner = (void*)(this_arg & (~1));
14074 this_arg_conv.is_owned = false;
14075 unsigned char header_arr[80];
14076 CHECK((*env)->GetArrayLength(env, header) == 80);
14077 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14078 unsigned char (*header_ref)[80] = &header_arr;
14079 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14080 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14081 if (txdata_constr.datalen > 0)
14082 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14084 txdata_constr.data = NULL;
14085 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14086 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14087 int64_t txdata_conv_24 = txdata_vals[y];
14088 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14089 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14090 txdata_constr.data[y] = txdata_conv_24_conv;
14092 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14093 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14094 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14096 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14098 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14099 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14101 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14103 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14104 if (logger_conv.free == LDKLogger_JCalls_free) {
14105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14106 LDKLogger_JCalls_clone(logger_conv.this_arg);
14108 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);
14109 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14110 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14111 for (size_t u = 0; u < ret_var.datalen; u++) {
14112 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14113 *ret_conv_46_ref = ret_var.data[u];
14114 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14116 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14117 FREE(ret_var.data);
14121 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) {
14122 LDKChannelMonitor this_arg_conv;
14123 this_arg_conv.inner = (void*)(this_arg & (~1));
14124 this_arg_conv.is_owned = false;
14125 unsigned char header_arr[80];
14126 CHECK((*env)->GetArrayLength(env, header) == 80);
14127 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14128 unsigned char (*header_ref)[80] = &header_arr;
14129 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14130 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14132 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14134 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14135 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14137 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14139 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14140 if (logger_conv.free == LDKLogger_JCalls_free) {
14141 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14142 LDKLogger_JCalls_clone(logger_conv.this_arg);
14144 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14147 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) {
14148 LDKChannelMonitor this_arg_conv;
14149 this_arg_conv.inner = (void*)(this_arg & (~1));
14150 this_arg_conv.is_owned = false;
14151 unsigned char header_arr[80];
14152 CHECK((*env)->GetArrayLength(env, header) == 80);
14153 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14154 unsigned char (*header_ref)[80] = &header_arr;
14155 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14156 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14157 if (txdata_constr.datalen > 0)
14158 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14160 txdata_constr.data = NULL;
14161 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14162 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14163 int64_t txdata_conv_24 = txdata_vals[y];
14164 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14165 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14166 txdata_constr.data[y] = txdata_conv_24_conv;
14168 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14169 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14170 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14171 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14172 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14174 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14175 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14176 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14177 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14179 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14180 if (logger_conv.free == LDKLogger_JCalls_free) {
14181 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14182 LDKLogger_JCalls_clone(logger_conv.this_arg);
14184 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);
14185 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14186 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14187 for (size_t u = 0; u < ret_var.datalen; u++) {
14188 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14189 *ret_conv_46_ref = ret_var.data[u];
14190 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14192 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14193 FREE(ret_var.data);
14197 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) {
14198 LDKChannelMonitor this_arg_conv;
14199 this_arg_conv.inner = (void*)(this_arg & (~1));
14200 this_arg_conv.is_owned = false;
14201 unsigned char txid_arr[32];
14202 CHECK((*env)->GetArrayLength(env, txid) == 32);
14203 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14204 unsigned char (*txid_ref)[32] = &txid_arr;
14205 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14206 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14208 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14210 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14211 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14212 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14213 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14215 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14216 if (logger_conv.free == LDKLogger_JCalls_free) {
14217 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14218 LDKLogger_JCalls_clone(logger_conv.this_arg);
14220 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14223 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) {
14224 LDKChannelMonitor this_arg_conv;
14225 this_arg_conv.inner = (void*)(this_arg & (~1));
14226 this_arg_conv.is_owned = false;
14227 unsigned char header_arr[80];
14228 CHECK((*env)->GetArrayLength(env, header) == 80);
14229 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14230 unsigned char (*header_ref)[80] = &header_arr;
14231 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14232 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14233 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14234 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14236 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14237 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14238 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14239 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14241 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14242 if (logger_conv.free == LDKLogger_JCalls_free) {
14243 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14244 LDKLogger_JCalls_clone(logger_conv.this_arg);
14246 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14247 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14248 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14249 for (size_t u = 0; u < ret_var.datalen; u++) {
14250 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14251 *ret_conv_46_ref = ret_var.data[u];
14252 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14254 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14255 FREE(ret_var.data);
14259 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14260 LDKChannelMonitor this_arg_conv;
14261 this_arg_conv.inner = (void*)(this_arg & (~1));
14262 this_arg_conv.is_owned = false;
14263 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14264 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14266 for (size_t i = 0; i < ret_var.datalen; i++) {
14267 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14268 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14269 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14271 FREE(ret_var.data);
14275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14276 if ((this_ptr & 1) != 0) return;
14277 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14278 FREE((void*)this_ptr);
14279 Persist_free(this_ptr_conv);
14282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14283 LDKu8slice ser_ref;
14284 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14285 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14286 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14287 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14288 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14289 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14290 return (uint64_t)ret_conv;
14293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14294 LDKOutPoint this_obj_conv;
14295 this_obj_conv.inner = (void*)(this_obj & (~1));
14296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14297 OutPoint_free(this_obj_conv);
14300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14301 LDKOutPoint this_ptr_conv;
14302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14303 this_ptr_conv.is_owned = false;
14304 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14305 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14310 LDKOutPoint this_ptr_conv;
14311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14312 this_ptr_conv.is_owned = false;
14313 LDKThirtyTwoBytes val_ref;
14314 CHECK((*env)->GetArrayLength(env, val) == 32);
14315 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14316 OutPoint_set_txid(&this_ptr_conv, val_ref);
14319 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14320 LDKOutPoint this_ptr_conv;
14321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14322 this_ptr_conv.is_owned = false;
14323 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14328 LDKOutPoint this_ptr_conv;
14329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14330 this_ptr_conv.is_owned = false;
14331 OutPoint_set_index(&this_ptr_conv, val);
14334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14335 LDKThirtyTwoBytes txid_arg_ref;
14336 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14337 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14338 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14341 uint64_t ret_ref = (uint64_t)ret_var.inner;
14342 if (ret_var.is_owned) {
14348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14349 LDKOutPoint orig_conv;
14350 orig_conv.inner = (void*)(orig & (~1));
14351 orig_conv.is_owned = false;
14352 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14355 uint64_t ret_ref = (uint64_t)ret_var.inner;
14356 if (ret_var.is_owned) {
14362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14363 LDKOutPoint a_conv;
14364 a_conv.inner = (void*)(a & (~1));
14365 a_conv.is_owned = false;
14366 LDKOutPoint b_conv;
14367 b_conv.inner = (void*)(b & (~1));
14368 b_conv.is_owned = false;
14369 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14374 LDKOutPoint o_conv;
14375 o_conv.inner = (void*)(o & (~1));
14376 o_conv.is_owned = false;
14377 int64_t ret_val = OutPoint_hash(&o_conv);
14381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14382 LDKOutPoint this_arg_conv;
14383 this_arg_conv.inner = (void*)(this_arg & (~1));
14384 this_arg_conv.is_owned = false;
14385 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14386 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14391 LDKOutPoint obj_conv;
14392 obj_conv.inner = (void*)(obj & (~1));
14393 obj_conv.is_owned = false;
14394 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14395 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14396 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14397 CVec_u8Z_free(ret_var);
14401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14402 LDKu8slice ser_ref;
14403 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14404 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14405 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14406 *ret_conv = OutPoint_read(ser_ref);
14407 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14408 return (uint64_t)ret_conv;
14411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14412 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14413 this_obj_conv.inner = (void*)(this_obj & (~1));
14414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14415 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14419 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14421 this_ptr_conv.is_owned = false;
14422 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14425 uint64_t ret_ref = (uint64_t)ret_var.inner;
14426 if (ret_var.is_owned) {
14432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14433 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14435 this_ptr_conv.is_owned = false;
14436 LDKOutPoint val_conv;
14437 val_conv.inner = (void*)(val & (~1));
14438 val_conv.is_owned = (val & 1) || (val == 0);
14439 val_conv = OutPoint_clone(&val_conv);
14440 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14444 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14446 this_ptr_conv.is_owned = false;
14447 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14453 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14455 this_ptr_conv.is_owned = false;
14456 LDKPublicKey val_ref;
14457 CHECK((*env)->GetArrayLength(env, val) == 33);
14458 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14459 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14462 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14463 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14465 this_ptr_conv.is_owned = false;
14466 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14471 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14473 this_ptr_conv.is_owned = false;
14474 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14478 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14480 this_ptr_conv.is_owned = false;
14481 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14482 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14486 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14488 this_ptr_conv.is_owned = false;
14489 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14490 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14495 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14497 this_ptr_conv.is_owned = false;
14498 LDKPublicKey val_ref;
14499 CHECK((*env)->GetArrayLength(env, val) == 33);
14500 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14501 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14505 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14507 this_ptr_conv.is_owned = false;
14508 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14509 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14514 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14516 this_ptr_conv.is_owned = false;
14517 LDKThirtyTwoBytes val_ref;
14518 CHECK((*env)->GetArrayLength(env, val) == 32);
14519 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14520 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14524 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14526 this_ptr_conv.is_owned = false;
14527 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14532 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14534 this_ptr_conv.is_owned = false;
14535 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14538 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) {
14539 LDKOutPoint outpoint_arg_conv;
14540 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14541 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14542 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14543 LDKPublicKey per_commitment_point_arg_ref;
14544 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14545 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14546 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14547 LDKPublicKey revocation_pubkey_arg_ref;
14548 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14549 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14550 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14551 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14552 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14553 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);
14554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14556 uint64_t ret_ref = (uint64_t)ret_var.inner;
14557 if (ret_var.is_owned) {
14563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14564 LDKDelayedPaymentOutputDescriptor orig_conv;
14565 orig_conv.inner = (void*)(orig & (~1));
14566 orig_conv.is_owned = false;
14567 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14570 uint64_t ret_ref = (uint64_t)ret_var.inner;
14571 if (ret_var.is_owned) {
14577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14578 LDKDelayedPaymentOutputDescriptor obj_conv;
14579 obj_conv.inner = (void*)(obj & (~1));
14580 obj_conv.is_owned = false;
14581 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14582 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14583 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14584 CVec_u8Z_free(ret_var);
14588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14589 LDKu8slice ser_ref;
14590 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14591 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14592 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14593 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14594 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14595 return (uint64_t)ret_conv;
14598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14599 LDKStaticPaymentOutputDescriptor this_obj_conv;
14600 this_obj_conv.inner = (void*)(this_obj & (~1));
14601 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14602 StaticPaymentOutputDescriptor_free(this_obj_conv);
14605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14606 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14608 this_ptr_conv.is_owned = false;
14609 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14612 uint64_t ret_ref = (uint64_t)ret_var.inner;
14613 if (ret_var.is_owned) {
14619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14620 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14622 this_ptr_conv.is_owned = false;
14623 LDKOutPoint val_conv;
14624 val_conv.inner = (void*)(val & (~1));
14625 val_conv.is_owned = (val & 1) || (val == 0);
14626 val_conv = OutPoint_clone(&val_conv);
14627 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14631 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14633 this_ptr_conv.is_owned = false;
14634 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14635 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14639 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14641 this_ptr_conv.is_owned = false;
14642 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14643 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14648 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14650 this_ptr_conv.is_owned = false;
14651 LDKThirtyTwoBytes val_ref;
14652 CHECK((*env)->GetArrayLength(env, val) == 32);
14653 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14654 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14658 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14660 this_ptr_conv.is_owned = false;
14661 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14666 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14668 this_ptr_conv.is_owned = false;
14669 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14672 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) {
14673 LDKOutPoint outpoint_arg_conv;
14674 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14675 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14676 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14677 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14678 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14679 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14680 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14681 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14684 uint64_t ret_ref = (uint64_t)ret_var.inner;
14685 if (ret_var.is_owned) {
14691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14692 LDKStaticPaymentOutputDescriptor orig_conv;
14693 orig_conv.inner = (void*)(orig & (~1));
14694 orig_conv.is_owned = false;
14695 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14698 uint64_t ret_ref = (uint64_t)ret_var.inner;
14699 if (ret_var.is_owned) {
14705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14706 LDKStaticPaymentOutputDescriptor obj_conv;
14707 obj_conv.inner = (void*)(obj & (~1));
14708 obj_conv.is_owned = false;
14709 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14710 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14711 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14712 CVec_u8Z_free(ret_var);
14716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14717 LDKu8slice ser_ref;
14718 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14719 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14720 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14721 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14722 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14723 return (uint64_t)ret_conv;
14726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14727 if ((this_ptr & 1) != 0) return;
14728 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14729 FREE((void*)this_ptr);
14730 SpendableOutputDescriptor_free(this_ptr_conv);
14733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14734 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14735 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14736 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14737 uint64_t ret_ref = (uint64_t)ret_copy;
14741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14742 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14743 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14744 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14745 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14746 CVec_u8Z_free(ret_var);
14750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14751 LDKu8slice ser_ref;
14752 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14753 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14754 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14755 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14756 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14757 return (uint64_t)ret_conv;
14760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14761 if ((this_ptr & 1) != 0) return;
14762 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14763 FREE((void*)this_ptr);
14764 BaseSign_free(this_ptr_conv);
14767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14768 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14769 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
14770 *ret = Sign_clone(orig_conv);
14771 return (uint64_t)ret;
14774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14775 if ((this_ptr & 1) != 0) return;
14776 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14777 FREE((void*)this_ptr);
14778 Sign_free(this_ptr_conv);
14781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14782 if ((this_ptr & 1) != 0) return;
14783 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14784 FREE((void*)this_ptr);
14785 KeysInterface_free(this_ptr_conv);
14788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14789 LDKInMemorySigner this_obj_conv;
14790 this_obj_conv.inner = (void*)(this_obj & (~1));
14791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14792 InMemorySigner_free(this_obj_conv);
14795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14796 LDKInMemorySigner this_ptr_conv;
14797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14798 this_ptr_conv.is_owned = false;
14799 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14800 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
14804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14805 LDKInMemorySigner this_ptr_conv;
14806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14807 this_ptr_conv.is_owned = false;
14808 LDKSecretKey val_ref;
14809 CHECK((*env)->GetArrayLength(env, val) == 32);
14810 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14811 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14815 LDKInMemorySigner this_ptr_conv;
14816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14817 this_ptr_conv.is_owned = false;
14818 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
14823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14824 LDKInMemorySigner this_ptr_conv;
14825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14826 this_ptr_conv.is_owned = false;
14827 LDKSecretKey val_ref;
14828 CHECK((*env)->GetArrayLength(env, val) == 32);
14829 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14830 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14834 LDKInMemorySigner 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, *InMemorySigner_get_payment_key(&this_ptr_conv));
14842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14843 LDKInMemorySigner this_ptr_conv;
14844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14845 this_ptr_conv.is_owned = false;
14846 LDKSecretKey val_ref;
14847 CHECK((*env)->GetArrayLength(env, val) == 32);
14848 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14849 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14853 LDKInMemorySigner this_ptr_conv;
14854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14855 this_ptr_conv.is_owned = false;
14856 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
14861 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) {
14862 LDKInMemorySigner this_ptr_conv;
14863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14864 this_ptr_conv.is_owned = false;
14865 LDKSecretKey val_ref;
14866 CHECK((*env)->GetArrayLength(env, val) == 32);
14867 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14868 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14872 LDKInMemorySigner this_ptr_conv;
14873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14874 this_ptr_conv.is_owned = false;
14875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
14880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14881 LDKInMemorySigner this_ptr_conv;
14882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14883 this_ptr_conv.is_owned = false;
14884 LDKSecretKey val_ref;
14885 CHECK((*env)->GetArrayLength(env, val) == 32);
14886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14887 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
14891 LDKInMemorySigner this_ptr_conv;
14892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14893 this_ptr_conv.is_owned = false;
14894 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
14899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14900 LDKInMemorySigner this_ptr_conv;
14901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14902 this_ptr_conv.is_owned = false;
14903 LDKThirtyTwoBytes val_ref;
14904 CHECK((*env)->GetArrayLength(env, val) == 32);
14905 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14906 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14910 LDKInMemorySigner orig_conv;
14911 orig_conv.inner = (void*)(orig & (~1));
14912 orig_conv.is_owned = false;
14913 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14916 uint64_t ret_ref = (uint64_t)ret_var.inner;
14917 if (ret_var.is_owned) {
14923 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) {
14924 LDKSecretKey funding_key_ref;
14925 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
14926 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
14927 LDKSecretKey revocation_base_key_ref;
14928 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
14929 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
14930 LDKSecretKey payment_key_ref;
14931 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
14932 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
14933 LDKSecretKey delayed_payment_base_key_ref;
14934 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
14935 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
14936 LDKSecretKey htlc_base_key_ref;
14937 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
14938 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
14939 LDKThirtyTwoBytes commitment_seed_ref;
14940 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14941 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
14942 LDKThirtyTwoBytes channel_keys_id_ref;
14943 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
14944 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
14945 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);
14946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14948 uint64_t ret_ref = (uint64_t)ret_var.inner;
14949 if (ret_var.is_owned) {
14955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
14956 LDKInMemorySigner this_arg_conv;
14957 this_arg_conv.inner = (void*)(this_arg & (~1));
14958 this_arg_conv.is_owned = false;
14959 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14960 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14961 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14962 uint64_t ret_ref = (uint64_t)ret_var.inner;
14963 if (ret_var.is_owned) {
14969 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14970 LDKInMemorySigner this_arg_conv;
14971 this_arg_conv.inner = (void*)(this_arg & (~1));
14972 this_arg_conv.is_owned = false;
14973 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14977 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14978 LDKInMemorySigner this_arg_conv;
14979 this_arg_conv.inner = (void*)(this_arg & (~1));
14980 this_arg_conv.is_owned = false;
14981 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
14986 LDKInMemorySigner this_arg_conv;
14987 this_arg_conv.inner = (void*)(this_arg & (~1));
14988 this_arg_conv.is_owned = false;
14989 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
14994 LDKInMemorySigner this_arg_conv;
14995 this_arg_conv.inner = (void*)(this_arg & (~1));
14996 this_arg_conv.is_owned = false;
14997 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15000 uint64_t ret_ref = (uint64_t)ret_var.inner;
15001 if (ret_var.is_owned) {
15007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15008 LDKInMemorySigner this_arg_conv;
15009 this_arg_conv.inner = (void*)(this_arg & (~1));
15010 this_arg_conv.is_owned = false;
15011 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15014 uint64_t ret_ref = (uint64_t)ret_var.inner;
15015 if (ret_var.is_owned) {
15021 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) {
15022 LDKInMemorySigner this_arg_conv;
15023 this_arg_conv.inner = (void*)(this_arg & (~1));
15024 this_arg_conv.is_owned = false;
15025 LDKTransaction spend_tx_ref;
15026 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15027 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15028 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15029 spend_tx_ref.data_is_owned = true;
15030 LDKStaticPaymentOutputDescriptor descriptor_conv;
15031 descriptor_conv.inner = (void*)(descriptor & (~1));
15032 descriptor_conv.is_owned = false;
15033 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15034 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15035 return (uint64_t)ret_conv;
15038 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) {
15039 LDKInMemorySigner this_arg_conv;
15040 this_arg_conv.inner = (void*)(this_arg & (~1));
15041 this_arg_conv.is_owned = false;
15042 LDKTransaction spend_tx_ref;
15043 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15044 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15045 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15046 spend_tx_ref.data_is_owned = true;
15047 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15048 descriptor_conv.inner = (void*)(descriptor & (~1));
15049 descriptor_conv.is_owned = false;
15050 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15051 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15052 return (uint64_t)ret_conv;
15055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15056 LDKInMemorySigner this_arg_conv;
15057 this_arg_conv.inner = (void*)(this_arg & (~1));
15058 this_arg_conv.is_owned = false;
15059 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15060 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15061 return (uint64_t)ret;
15064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15065 LDKInMemorySigner this_arg_conv;
15066 this_arg_conv.inner = (void*)(this_arg & (~1));
15067 this_arg_conv.is_owned = false;
15068 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15069 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15070 return (uint64_t)ret;
15073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15074 LDKInMemorySigner obj_conv;
15075 obj_conv.inner = (void*)(obj & (~1));
15076 obj_conv.is_owned = false;
15077 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15078 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15079 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15080 CVec_u8Z_free(ret_var);
15084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15085 LDKu8slice ser_ref;
15086 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15087 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15088 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15089 *ret_conv = InMemorySigner_read(ser_ref);
15090 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15091 return (uint64_t)ret_conv;
15094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15095 LDKKeysManager this_obj_conv;
15096 this_obj_conv.inner = (void*)(this_obj & (~1));
15097 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15098 KeysManager_free(this_obj_conv);
15101 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) {
15102 unsigned char seed_arr[32];
15103 CHECK((*env)->GetArrayLength(env, seed) == 32);
15104 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15105 unsigned char (*seed_ref)[32] = &seed_arr;
15106 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15109 uint64_t ret_ref = (uint64_t)ret_var.inner;
15110 if (ret_var.is_owned) {
15116 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) {
15117 LDKKeysManager this_arg_conv;
15118 this_arg_conv.inner = (void*)(this_arg & (~1));
15119 this_arg_conv.is_owned = false;
15120 unsigned char params_arr[32];
15121 CHECK((*env)->GetArrayLength(env, params) == 32);
15122 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15123 unsigned char (*params_ref)[32] = ¶ms_arr;
15124 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15127 uint64_t ret_ref = (uint64_t)ret_var.inner;
15128 if (ret_var.is_owned) {
15134 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) {
15135 LDKKeysManager this_arg_conv;
15136 this_arg_conv.inner = (void*)(this_arg & (~1));
15137 this_arg_conv.is_owned = false;
15138 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15139 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15140 if (descriptors_constr.datalen > 0)
15141 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15143 descriptors_constr.data = NULL;
15144 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15145 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15146 int64_t descriptors_conv_27 = descriptors_vals[b];
15147 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15148 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15149 descriptors_constr.data[b] = descriptors_conv_27_conv;
15151 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15152 LDKCVec_TxOutZ outputs_constr;
15153 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15154 if (outputs_constr.datalen > 0)
15155 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15157 outputs_constr.data = NULL;
15158 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15159 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15160 int64_t outputs_conv_7 = outputs_vals[h];
15161 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15162 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15163 outputs_constr.data[h] = outputs_conv_7_conv;
15165 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15166 LDKCVec_u8Z change_destination_script_ref;
15167 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15168 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15169 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15170 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15171 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15172 return (uint64_t)ret_conv;
15175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15176 LDKKeysManager this_arg_conv;
15177 this_arg_conv.inner = (void*)(this_arg & (~1));
15178 this_arg_conv.is_owned = false;
15179 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15180 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15181 return (uint64_t)ret;
15184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15185 LDKChannelManager this_obj_conv;
15186 this_obj_conv.inner = (void*)(this_obj & (~1));
15187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15188 ChannelManager_free(this_obj_conv);
15191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15192 LDKChainParameters this_obj_conv;
15193 this_obj_conv.inner = (void*)(this_obj & (~1));
15194 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15195 ChainParameters_free(this_obj_conv);
15198 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15199 LDKChainParameters this_ptr_conv;
15200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15201 this_ptr_conv.is_owned = false;
15202 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15207 LDKChainParameters this_ptr_conv;
15208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15209 this_ptr_conv.is_owned = false;
15210 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15211 ChainParameters_set_network(&this_ptr_conv, val_conv);
15214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15215 LDKChainParameters this_ptr_conv;
15216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15217 this_ptr_conv.is_owned = false;
15218 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15221 uint64_t ret_ref = (uint64_t)ret_var.inner;
15222 if (ret_var.is_owned) {
15228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15229 LDKChainParameters this_ptr_conv;
15230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15231 this_ptr_conv.is_owned = false;
15232 LDKBestBlock val_conv;
15233 val_conv.inner = (void*)(val & (~1));
15234 val_conv.is_owned = (val & 1) || (val == 0);
15235 val_conv = BestBlock_clone(&val_conv);
15236 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15240 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15241 LDKBestBlock best_block_arg_conv;
15242 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15243 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15244 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15245 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15248 uint64_t ret_ref = (uint64_t)ret_var.inner;
15249 if (ret_var.is_owned) {
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15256 LDKChainParameters orig_conv;
15257 orig_conv.inner = (void*)(orig & (~1));
15258 orig_conv.is_owned = false;
15259 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15262 uint64_t ret_ref = (uint64_t)ret_var.inner;
15263 if (ret_var.is_owned) {
15269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15270 LDKBestBlock this_obj_conv;
15271 this_obj_conv.inner = (void*)(this_obj & (~1));
15272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15273 BestBlock_free(this_obj_conv);
15276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15277 LDKBestBlock orig_conv;
15278 orig_conv.inner = (void*)(orig & (~1));
15279 orig_conv.is_owned = false;
15280 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15283 uint64_t ret_ref = (uint64_t)ret_var.inner;
15284 if (ret_var.is_owned) {
15290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15291 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15292 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15293 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15294 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15295 uint64_t ret_ref = (uint64_t)ret_var.inner;
15296 if (ret_var.is_owned) {
15302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15303 LDKThirtyTwoBytes block_hash_ref;
15304 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15305 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15306 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15309 uint64_t ret_ref = (uint64_t)ret_var.inner;
15310 if (ret_var.is_owned) {
15316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15317 LDKBestBlock this_arg_conv;
15318 this_arg_conv.inner = (void*)(this_arg & (~1));
15319 this_arg_conv.is_owned = false;
15320 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15321 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15325 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15326 LDKBestBlock this_arg_conv;
15327 this_arg_conv.inner = (void*)(this_arg & (~1));
15328 this_arg_conv.is_owned = false;
15329 int32_t ret_val = BestBlock_height(&this_arg_conv);
15333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15334 LDKChannelDetails this_obj_conv;
15335 this_obj_conv.inner = (void*)(this_obj & (~1));
15336 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15337 ChannelDetails_free(this_obj_conv);
15340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15341 LDKChannelDetails this_ptr_conv;
15342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15343 this_ptr_conv.is_owned = false;
15344 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15350 LDKChannelDetails this_ptr_conv;
15351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15352 this_ptr_conv.is_owned = false;
15353 LDKThirtyTwoBytes val_ref;
15354 CHECK((*env)->GetArrayLength(env, val) == 32);
15355 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15356 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15360 LDKChannelDetails this_ptr_conv;
15361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15362 this_ptr_conv.is_owned = false;
15363 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15366 uint64_t ret_ref = (uint64_t)ret_var.inner;
15367 if (ret_var.is_owned) {
15373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15374 LDKChannelDetails this_ptr_conv;
15375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15376 this_ptr_conv.is_owned = false;
15377 LDKOutPoint val_conv;
15378 val_conv.inner = (void*)(val & (~1));
15379 val_conv.is_owned = (val & 1) || (val == 0);
15380 val_conv = OutPoint_clone(&val_conv);
15381 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15385 LDKChannelDetails this_ptr_conv;
15386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15387 this_ptr_conv.is_owned = false;
15388 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15389 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15390 uint64_t ret_ref = (uint64_t)ret_copy;
15394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15395 LDKChannelDetails this_ptr_conv;
15396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15397 this_ptr_conv.is_owned = false;
15398 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15399 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15403 LDKChannelDetails this_ptr_conv;
15404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15405 this_ptr_conv.is_owned = false;
15406 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15412 LDKChannelDetails this_ptr_conv;
15413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15414 this_ptr_conv.is_owned = false;
15415 LDKPublicKey val_ref;
15416 CHECK((*env)->GetArrayLength(env, val) == 33);
15417 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15418 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15422 LDKChannelDetails this_ptr_conv;
15423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15424 this_ptr_conv.is_owned = false;
15425 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15428 uint64_t ret_ref = (uint64_t)ret_var.inner;
15429 if (ret_var.is_owned) {
15435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15436 LDKChannelDetails this_ptr_conv;
15437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15438 this_ptr_conv.is_owned = false;
15439 LDKInitFeatures val_conv;
15440 val_conv.inner = (void*)(val & (~1));
15441 val_conv.is_owned = (val & 1) || (val == 0);
15442 val_conv = InitFeatures_clone(&val_conv);
15443 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15447 LDKChannelDetails this_ptr_conv;
15448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15449 this_ptr_conv.is_owned = false;
15450 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15455 LDKChannelDetails this_ptr_conv;
15456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15457 this_ptr_conv.is_owned = false;
15458 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15462 LDKChannelDetails this_ptr_conv;
15463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15464 this_ptr_conv.is_owned = false;
15465 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15470 LDKChannelDetails this_ptr_conv;
15471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15472 this_ptr_conv.is_owned = false;
15473 ChannelDetails_set_user_id(&this_ptr_conv, val);
15476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15477 LDKChannelDetails this_ptr_conv;
15478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15479 this_ptr_conv.is_owned = false;
15480 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15485 LDKChannelDetails this_ptr_conv;
15486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15487 this_ptr_conv.is_owned = false;
15488 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15492 LDKChannelDetails this_ptr_conv;
15493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15494 this_ptr_conv.is_owned = false;
15495 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15500 LDKChannelDetails this_ptr_conv;
15501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15502 this_ptr_conv.is_owned = false;
15503 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15507 LDKChannelDetails this_ptr_conv;
15508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15509 this_ptr_conv.is_owned = false;
15510 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15515 LDKChannelDetails this_ptr_conv;
15516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15517 this_ptr_conv.is_owned = false;
15518 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15522 LDKChannelDetails this_ptr_conv;
15523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15524 this_ptr_conv.is_owned = false;
15525 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15530 LDKChannelDetails this_ptr_conv;
15531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15532 this_ptr_conv.is_owned = false;
15533 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15537 LDKChannelDetails this_ptr_conv;
15538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15539 this_ptr_conv.is_owned = false;
15540 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15545 LDKChannelDetails this_ptr_conv;
15546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15547 this_ptr_conv.is_owned = false;
15548 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15552 LDKChannelDetails this_ptr_conv;
15553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15554 this_ptr_conv.is_owned = false;
15555 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15560 LDKChannelDetails this_ptr_conv;
15561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15562 this_ptr_conv.is_owned = false;
15563 ChannelDetails_set_is_public(&this_ptr_conv, val);
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15567 LDKChannelDetails orig_conv;
15568 orig_conv.inner = (void*)(orig & (~1));
15569 orig_conv.is_owned = false;
15570 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15573 uint64_t ret_ref = (uint64_t)ret_var.inner;
15574 if (ret_var.is_owned) {
15580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15581 if ((this_ptr & 1) != 0) return;
15582 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15583 FREE((void*)this_ptr);
15584 PaymentSendFailure_free(this_ptr_conv);
15587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15588 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15589 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15590 *ret_copy = PaymentSendFailure_clone(orig_conv);
15591 uint64_t ret_ref = (uint64_t)ret_copy;
15595 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) {
15596 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15597 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15598 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15599 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15601 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15602 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15603 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15604 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15606 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15607 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15608 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15609 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15611 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15612 if (logger_conv.free == LDKLogger_JCalls_free) {
15613 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15614 LDKLogger_JCalls_clone(logger_conv.this_arg);
15616 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15617 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15618 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15619 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15621 LDKUserConfig config_conv;
15622 config_conv.inner = (void*)(config & (~1));
15623 config_conv.is_owned = (config & 1) || (config == 0);
15624 config_conv = UserConfig_clone(&config_conv);
15625 LDKChainParameters params_conv;
15626 params_conv.inner = (void*)(params & (~1));
15627 params_conv.is_owned = (params & 1) || (params == 0);
15628 params_conv = ChainParameters_clone(¶ms_conv);
15629 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15632 uint64_t ret_ref = (uint64_t)ret_var.inner;
15633 if (ret_var.is_owned) {
15639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15640 LDKChannelManager this_arg_conv;
15641 this_arg_conv.inner = (void*)(this_arg & (~1));
15642 this_arg_conv.is_owned = false;
15643 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15644 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15645 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15646 uint64_t ret_ref = (uint64_t)ret_var.inner;
15647 if (ret_var.is_owned) {
15653 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) {
15654 LDKChannelManager this_arg_conv;
15655 this_arg_conv.inner = (void*)(this_arg & (~1));
15656 this_arg_conv.is_owned = false;
15657 LDKPublicKey their_network_key_ref;
15658 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15659 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15660 LDKUserConfig override_config_conv;
15661 override_config_conv.inner = (void*)(override_config & (~1));
15662 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15663 override_config_conv = UserConfig_clone(&override_config_conv);
15664 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15665 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15666 return (uint64_t)ret_conv;
15669 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15670 LDKChannelManager this_arg_conv;
15671 this_arg_conv.inner = (void*)(this_arg & (~1));
15672 this_arg_conv.is_owned = false;
15673 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15674 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15675 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15676 for (size_t q = 0; q < ret_var.datalen; q++) {
15677 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15678 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15679 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15680 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15681 if (ret_conv_16_var.is_owned) {
15682 ret_conv_16_ref |= 1;
15684 ret_arr_ptr[q] = ret_conv_16_ref;
15686 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15687 FREE(ret_var.data);
15691 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15692 LDKChannelManager this_arg_conv;
15693 this_arg_conv.inner = (void*)(this_arg & (~1));
15694 this_arg_conv.is_owned = false;
15695 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15696 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15697 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15698 for (size_t q = 0; q < ret_var.datalen; q++) {
15699 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15700 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15701 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15702 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15703 if (ret_conv_16_var.is_owned) {
15704 ret_conv_16_ref |= 1;
15706 ret_arr_ptr[q] = ret_conv_16_ref;
15708 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15709 FREE(ret_var.data);
15713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
15714 LDKChannelManager this_arg_conv;
15715 this_arg_conv.inner = (void*)(this_arg & (~1));
15716 this_arg_conv.is_owned = false;
15717 unsigned char channel_id_arr[32];
15718 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15719 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15720 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15721 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15722 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15723 return (uint64_t)ret_conv;
15726 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) {
15727 LDKChannelManager this_arg_conv;
15728 this_arg_conv.inner = (void*)(this_arg & (~1));
15729 this_arg_conv.is_owned = false;
15730 unsigned char channel_id_arr[32];
15731 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15732 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15733 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15734 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15735 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15736 return (uint64_t)ret_conv;
15739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15740 LDKChannelManager this_arg_conv;
15741 this_arg_conv.inner = (void*)(this_arg & (~1));
15742 this_arg_conv.is_owned = false;
15743 ChannelManager_force_close_all_channels(&this_arg_conv);
15746 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) {
15747 LDKChannelManager this_arg_conv;
15748 this_arg_conv.inner = (void*)(this_arg & (~1));
15749 this_arg_conv.is_owned = false;
15750 LDKRoute route_conv;
15751 route_conv.inner = (void*)(route & (~1));
15752 route_conv.is_owned = false;
15753 LDKThirtyTwoBytes payment_hash_ref;
15754 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15755 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15756 LDKThirtyTwoBytes payment_secret_ref;
15757 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15758 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15759 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15760 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15761 return (uint64_t)ret_conv;
15764 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) {
15765 LDKChannelManager this_arg_conv;
15766 this_arg_conv.inner = (void*)(this_arg & (~1));
15767 this_arg_conv.is_owned = false;
15768 unsigned char temporary_channel_id_arr[32];
15769 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15770 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
15771 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15772 LDKTransaction funding_transaction_ref;
15773 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
15774 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15775 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
15776 funding_transaction_ref.data_is_owned = true;
15777 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15778 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15779 return (uint64_t)ret_conv;
15782 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) {
15783 LDKChannelManager this_arg_conv;
15784 this_arg_conv.inner = (void*)(this_arg & (~1));
15785 this_arg_conv.is_owned = false;
15786 LDKThreeBytes rgb_ref;
15787 CHECK((*env)->GetArrayLength(env, rgb) == 3);
15788 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
15789 LDKThirtyTwoBytes alias_ref;
15790 CHECK((*env)->GetArrayLength(env, alias) == 32);
15791 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
15792 LDKCVec_NetAddressZ addresses_constr;
15793 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
15794 if (addresses_constr.datalen > 0)
15795 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15797 addresses_constr.data = NULL;
15798 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
15799 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15800 int64_t addresses_conv_12 = addresses_vals[m];
15801 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15802 addresses_constr.data[m] = addresses_conv_12_conv;
15804 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
15805 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
15809 LDKChannelManager this_arg_conv;
15810 this_arg_conv.inner = (void*)(this_arg & (~1));
15811 this_arg_conv.is_owned = false;
15812 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
15816 LDKChannelManager this_arg_conv;
15817 this_arg_conv.inner = (void*)(this_arg & (~1));
15818 this_arg_conv.is_owned = false;
15819 ChannelManager_timer_tick_occurred(&this_arg_conv);
15822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
15823 LDKChannelManager this_arg_conv;
15824 this_arg_conv.inner = (void*)(this_arg & (~1));
15825 this_arg_conv.is_owned = false;
15826 unsigned char payment_hash_arr[32];
15827 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15828 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
15829 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15830 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
15835 LDKChannelManager this_arg_conv;
15836 this_arg_conv.inner = (void*)(this_arg & (~1));
15837 this_arg_conv.is_owned = false;
15838 LDKThirtyTwoBytes payment_preimage_ref;
15839 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15840 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15841 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15846 LDKChannelManager this_arg_conv;
15847 this_arg_conv.inner = (void*)(this_arg & (~1));
15848 this_arg_conv.is_owned = false;
15849 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15850 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
15854 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) {
15855 LDKChannelManager this_arg_conv;
15856 this_arg_conv.inner = (void*)(this_arg & (~1));
15857 this_arg_conv.is_owned = false;
15858 LDKOutPoint funding_txo_conv;
15859 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15860 funding_txo_conv.is_owned = false;
15861 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15864 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) {
15865 LDKChannelManager this_arg_conv;
15866 this_arg_conv.inner = (void*)(this_arg & (~1));
15867 this_arg_conv.is_owned = false;
15868 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15869 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15870 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15871 return (uint64_t)ret_ref;
15874 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) {
15875 LDKChannelManager this_arg_conv;
15876 this_arg_conv.inner = (void*)(this_arg & (~1));
15877 this_arg_conv.is_owned = false;
15878 LDKThirtyTwoBytes payment_hash_ref;
15879 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15880 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15881 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15882 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15883 *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);
15884 return (uint64_t)ret_conv;
15887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15888 LDKChannelManager this_arg_conv;
15889 this_arg_conv.inner = (void*)(this_arg & (~1));
15890 this_arg_conv.is_owned = false;
15891 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15892 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15893 return (uint64_t)ret;
15896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15897 LDKChannelManager this_arg_conv;
15898 this_arg_conv.inner = (void*)(this_arg & (~1));
15899 this_arg_conv.is_owned = false;
15900 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15901 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15902 return (uint64_t)ret;
15905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15906 LDKChannelManager this_arg_conv;
15907 this_arg_conv.inner = (void*)(this_arg & (~1));
15908 this_arg_conv.is_owned = false;
15909 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15910 *ret = ChannelManager_as_Listen(&this_arg_conv);
15911 return (uint64_t)ret;
15914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15915 LDKChannelManager this_arg_conv;
15916 this_arg_conv.inner = (void*)(this_arg & (~1));
15917 this_arg_conv.is_owned = false;
15918 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15919 *ret = ChannelManager_as_Confirm(&this_arg_conv);
15920 return (uint64_t)ret;
15923 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) {
15924 LDKChannelManager this_arg_conv;
15925 this_arg_conv.inner = (void*)(this_arg & (~1));
15926 this_arg_conv.is_owned = false;
15927 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
15932 LDKChannelManager this_arg_conv;
15933 this_arg_conv.inner = (void*)(this_arg & (~1));
15934 this_arg_conv.is_owned = false;
15935 ChannelManager_await_persistable_update(&this_arg_conv);
15938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
15939 LDKChannelManager this_arg_conv;
15940 this_arg_conv.inner = (void*)(this_arg & (~1));
15941 this_arg_conv.is_owned = false;
15942 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15943 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15944 return (uint64_t)ret;
15947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
15948 LDKChannelManager obj_conv;
15949 obj_conv.inner = (void*)(obj & (~1));
15950 obj_conv.is_owned = false;
15951 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15952 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15953 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15954 CVec_u8Z_free(ret_var);
15958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15959 LDKChannelManagerReadArgs this_obj_conv;
15960 this_obj_conv.inner = (void*)(this_obj & (~1));
15961 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15962 ChannelManagerReadArgs_free(this_obj_conv);
15965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
15966 LDKChannelManagerReadArgs this_ptr_conv;
15967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15968 this_ptr_conv.is_owned = false;
15969 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15974 LDKChannelManagerReadArgs this_ptr_conv;
15975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15976 this_ptr_conv.is_owned = false;
15977 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15978 if (val_conv.free == LDKKeysInterface_JCalls_free) {
15979 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15980 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
15982 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
15986 LDKChannelManagerReadArgs this_ptr_conv;
15987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15988 this_ptr_conv.is_owned = false;
15989 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15994 LDKChannelManagerReadArgs this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = false;
15997 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
15998 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
15999 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16000 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
16002 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16006 LDKChannelManagerReadArgs this_ptr_conv;
16007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16008 this_ptr_conv.is_owned = false;
16009 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16014 LDKChannelManagerReadArgs this_ptr_conv;
16015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16016 this_ptr_conv.is_owned = false;
16017 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16018 if (val_conv.free == LDKWatch_JCalls_free) {
16019 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16020 LDKWatch_JCalls_clone(val_conv.this_arg);
16022 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16026 LDKChannelManagerReadArgs this_ptr_conv;
16027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16028 this_ptr_conv.is_owned = false;
16029 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16034 LDKChannelManagerReadArgs this_ptr_conv;
16035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16036 this_ptr_conv.is_owned = false;
16037 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16038 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16040 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16042 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16046 LDKChannelManagerReadArgs this_ptr_conv;
16047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16048 this_ptr_conv.is_owned = false;
16049 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16054 LDKChannelManagerReadArgs this_ptr_conv;
16055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16056 this_ptr_conv.is_owned = false;
16057 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16058 if (val_conv.free == LDKLogger_JCalls_free) {
16059 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16060 LDKLogger_JCalls_clone(val_conv.this_arg);
16062 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16066 LDKChannelManagerReadArgs this_ptr_conv;
16067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16068 this_ptr_conv.is_owned = false;
16069 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16072 uint64_t ret_ref = (uint64_t)ret_var.inner;
16073 if (ret_var.is_owned) {
16079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16080 LDKChannelManagerReadArgs this_ptr_conv;
16081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16082 this_ptr_conv.is_owned = false;
16083 LDKUserConfig val_conv;
16084 val_conv.inner = (void*)(val & (~1));
16085 val_conv.is_owned = (val & 1) || (val == 0);
16086 val_conv = UserConfig_clone(&val_conv);
16087 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16090 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) {
16091 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16092 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16094 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16096 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16097 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16099 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16101 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16102 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16103 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16104 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16106 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16107 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16108 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16109 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16111 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16112 if (logger_conv.free == LDKLogger_JCalls_free) {
16113 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16114 LDKLogger_JCalls_clone(logger_conv.this_arg);
16116 LDKUserConfig default_config_conv;
16117 default_config_conv.inner = (void*)(default_config & (~1));
16118 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16119 default_config_conv = UserConfig_clone(&default_config_conv);
16120 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16121 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16122 if (channel_monitors_constr.datalen > 0)
16123 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16125 channel_monitors_constr.data = NULL;
16126 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16127 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16128 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16129 LDKChannelMonitor channel_monitors_conv_16_conv;
16130 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16131 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16132 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16134 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16135 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);
16136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16138 uint64_t ret_ref = (uint64_t)ret_var.inner;
16139 if (ret_var.is_owned) {
16145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16146 LDKu8slice ser_ref;
16147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16149 LDKChannelManagerReadArgs arg_conv;
16150 arg_conv.inner = (void*)(arg & (~1));
16151 arg_conv.is_owned = (arg & 1) || (arg == 0);
16152 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16153 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16154 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16155 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16156 return (uint64_t)ret_conv;
16159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16160 LDKDecodeError this_obj_conv;
16161 this_obj_conv.inner = (void*)(this_obj & (~1));
16162 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16163 DecodeError_free(this_obj_conv);
16166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16167 LDKDecodeError orig_conv;
16168 orig_conv.inner = (void*)(orig & (~1));
16169 orig_conv.is_owned = false;
16170 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16173 uint64_t ret_ref = (uint64_t)ret_var.inner;
16174 if (ret_var.is_owned) {
16180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16181 LDKInit this_obj_conv;
16182 this_obj_conv.inner = (void*)(this_obj & (~1));
16183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16184 Init_free(this_obj_conv);
16187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16188 LDKInit this_ptr_conv;
16189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16190 this_ptr_conv.is_owned = false;
16191 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16194 uint64_t ret_ref = (uint64_t)ret_var.inner;
16195 if (ret_var.is_owned) {
16201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16202 LDKInit this_ptr_conv;
16203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16204 this_ptr_conv.is_owned = false;
16205 LDKInitFeatures val_conv;
16206 val_conv.inner = (void*)(val & (~1));
16207 val_conv.is_owned = (val & 1) || (val == 0);
16208 val_conv = InitFeatures_clone(&val_conv);
16209 Init_set_features(&this_ptr_conv, val_conv);
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16213 LDKInitFeatures features_arg_conv;
16214 features_arg_conv.inner = (void*)(features_arg & (~1));
16215 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16216 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16217 LDKInit ret_var = Init_new(features_arg_conv);
16218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16220 uint64_t ret_ref = (uint64_t)ret_var.inner;
16221 if (ret_var.is_owned) {
16227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16229 orig_conv.inner = (void*)(orig & (~1));
16230 orig_conv.is_owned = false;
16231 LDKInit ret_var = Init_clone(&orig_conv);
16232 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16233 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16234 uint64_t ret_ref = (uint64_t)ret_var.inner;
16235 if (ret_var.is_owned) {
16241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16242 LDKErrorMessage this_obj_conv;
16243 this_obj_conv.inner = (void*)(this_obj & (~1));
16244 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16245 ErrorMessage_free(this_obj_conv);
16248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16249 LDKErrorMessage this_ptr_conv;
16250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16251 this_ptr_conv.is_owned = false;
16252 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16258 LDKErrorMessage this_ptr_conv;
16259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16260 this_ptr_conv.is_owned = false;
16261 LDKThirtyTwoBytes val_ref;
16262 CHECK((*env)->GetArrayLength(env, val) == 32);
16263 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16264 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16267 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16268 LDKErrorMessage this_ptr_conv;
16269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16270 this_ptr_conv.is_owned = false;
16271 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16272 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16277 LDKErrorMessage this_ptr_conv;
16278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16279 this_ptr_conv.is_owned = false;
16280 LDKStr val_conv = java_to_owned_str(env, val);
16281 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16285 LDKThirtyTwoBytes channel_id_arg_ref;
16286 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16287 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16288 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16289 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16292 uint64_t ret_ref = (uint64_t)ret_var.inner;
16293 if (ret_var.is_owned) {
16299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16300 LDKErrorMessage orig_conv;
16301 orig_conv.inner = (void*)(orig & (~1));
16302 orig_conv.is_owned = false;
16303 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16306 uint64_t ret_ref = (uint64_t)ret_var.inner;
16307 if (ret_var.is_owned) {
16313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16314 LDKPing this_obj_conv;
16315 this_obj_conv.inner = (void*)(this_obj & (~1));
16316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16317 Ping_free(this_obj_conv);
16320 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16321 LDKPing this_ptr_conv;
16322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16323 this_ptr_conv.is_owned = false;
16324 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16329 LDKPing this_ptr_conv;
16330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16331 this_ptr_conv.is_owned = false;
16332 Ping_set_ponglen(&this_ptr_conv, val);
16335 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16336 LDKPing this_ptr_conv;
16337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16338 this_ptr_conv.is_owned = false;
16339 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16344 LDKPing this_ptr_conv;
16345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16346 this_ptr_conv.is_owned = false;
16347 Ping_set_byteslen(&this_ptr_conv, val);
16350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16351 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16354 uint64_t ret_ref = (uint64_t)ret_var.inner;
16355 if (ret_var.is_owned) {
16361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16363 orig_conv.inner = (void*)(orig & (~1));
16364 orig_conv.is_owned = false;
16365 LDKPing ret_var = Ping_clone(&orig_conv);
16366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16368 uint64_t ret_ref = (uint64_t)ret_var.inner;
16369 if (ret_var.is_owned) {
16375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16376 LDKPong this_obj_conv;
16377 this_obj_conv.inner = (void*)(this_obj & (~1));
16378 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16379 Pong_free(this_obj_conv);
16382 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16383 LDKPong this_ptr_conv;
16384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16385 this_ptr_conv.is_owned = false;
16386 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16391 LDKPong this_ptr_conv;
16392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16393 this_ptr_conv.is_owned = false;
16394 Pong_set_byteslen(&this_ptr_conv, val);
16397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16398 LDKPong ret_var = Pong_new(byteslen_arg);
16399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16401 uint64_t ret_ref = (uint64_t)ret_var.inner;
16402 if (ret_var.is_owned) {
16408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16410 orig_conv.inner = (void*)(orig & (~1));
16411 orig_conv.is_owned = false;
16412 LDKPong ret_var = Pong_clone(&orig_conv);
16413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16415 uint64_t ret_ref = (uint64_t)ret_var.inner;
16416 if (ret_var.is_owned) {
16422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16423 LDKOpenChannel this_obj_conv;
16424 this_obj_conv.inner = (void*)(this_obj & (~1));
16425 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16426 OpenChannel_free(this_obj_conv);
16429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16430 LDKOpenChannel this_ptr_conv;
16431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16432 this_ptr_conv.is_owned = false;
16433 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16439 LDKOpenChannel this_ptr_conv;
16440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16441 this_ptr_conv.is_owned = false;
16442 LDKThirtyTwoBytes val_ref;
16443 CHECK((*env)->GetArrayLength(env, val) == 32);
16444 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16445 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16449 LDKOpenChannel this_ptr_conv;
16450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16451 this_ptr_conv.is_owned = false;
16452 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16458 LDKOpenChannel this_ptr_conv;
16459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16460 this_ptr_conv.is_owned = false;
16461 LDKThirtyTwoBytes val_ref;
16462 CHECK((*env)->GetArrayLength(env, val) == 32);
16463 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16464 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16468 LDKOpenChannel this_ptr_conv;
16469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16470 this_ptr_conv.is_owned = false;
16471 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16476 LDKOpenChannel this_ptr_conv;
16477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16478 this_ptr_conv.is_owned = false;
16479 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16483 LDKOpenChannel this_ptr_conv;
16484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16485 this_ptr_conv.is_owned = false;
16486 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16491 LDKOpenChannel this_ptr_conv;
16492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16493 this_ptr_conv.is_owned = false;
16494 OpenChannel_set_push_msat(&this_ptr_conv, val);
16497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16498 LDKOpenChannel this_ptr_conv;
16499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16500 this_ptr_conv.is_owned = false;
16501 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16506 LDKOpenChannel this_ptr_conv;
16507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16508 this_ptr_conv.is_owned = false;
16509 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16512 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) {
16513 LDKOpenChannel this_ptr_conv;
16514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16515 this_ptr_conv.is_owned = false;
16516 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16520 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) {
16521 LDKOpenChannel this_ptr_conv;
16522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16523 this_ptr_conv.is_owned = false;
16524 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16528 LDKOpenChannel this_ptr_conv;
16529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16530 this_ptr_conv.is_owned = false;
16531 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16536 LDKOpenChannel this_ptr_conv;
16537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16538 this_ptr_conv.is_owned = false;
16539 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16543 LDKOpenChannel this_ptr_conv;
16544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16545 this_ptr_conv.is_owned = false;
16546 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16551 LDKOpenChannel this_ptr_conv;
16552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16553 this_ptr_conv.is_owned = false;
16554 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16557 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16558 LDKOpenChannel this_ptr_conv;
16559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16560 this_ptr_conv.is_owned = false;
16561 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16566 LDKOpenChannel this_ptr_conv;
16567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16568 this_ptr_conv.is_owned = false;
16569 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16572 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16573 LDKOpenChannel this_ptr_conv;
16574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16575 this_ptr_conv.is_owned = false;
16576 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16581 LDKOpenChannel this_ptr_conv;
16582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16583 this_ptr_conv.is_owned = false;
16584 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16587 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16588 LDKOpenChannel this_ptr_conv;
16589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16590 this_ptr_conv.is_owned = false;
16591 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16596 LDKOpenChannel this_ptr_conv;
16597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16598 this_ptr_conv.is_owned = false;
16599 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16603 LDKOpenChannel this_ptr_conv;
16604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16605 this_ptr_conv.is_owned = false;
16606 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16612 LDKOpenChannel this_ptr_conv;
16613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16614 this_ptr_conv.is_owned = false;
16615 LDKPublicKey val_ref;
16616 CHECK((*env)->GetArrayLength(env, val) == 33);
16617 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16618 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16622 LDKOpenChannel this_ptr_conv;
16623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16624 this_ptr_conv.is_owned = false;
16625 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16626 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16631 LDKOpenChannel this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = false;
16634 LDKPublicKey val_ref;
16635 CHECK((*env)->GetArrayLength(env, val) == 33);
16636 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16637 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16641 LDKOpenChannel this_ptr_conv;
16642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16643 this_ptr_conv.is_owned = false;
16644 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16645 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16650 LDKOpenChannel this_ptr_conv;
16651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16652 this_ptr_conv.is_owned = false;
16653 LDKPublicKey val_ref;
16654 CHECK((*env)->GetArrayLength(env, val) == 33);
16655 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16656 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16660 LDKOpenChannel this_ptr_conv;
16661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16662 this_ptr_conv.is_owned = false;
16663 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16664 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16669 LDKOpenChannel this_ptr_conv;
16670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16671 this_ptr_conv.is_owned = false;
16672 LDKPublicKey val_ref;
16673 CHECK((*env)->GetArrayLength(env, val) == 33);
16674 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16675 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16679 LDKOpenChannel this_ptr_conv;
16680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16681 this_ptr_conv.is_owned = false;
16682 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16683 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16688 LDKOpenChannel this_ptr_conv;
16689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16690 this_ptr_conv.is_owned = false;
16691 LDKPublicKey val_ref;
16692 CHECK((*env)->GetArrayLength(env, val) == 33);
16693 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16694 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16698 LDKOpenChannel this_ptr_conv;
16699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16700 this_ptr_conv.is_owned = false;
16701 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16702 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16706 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) {
16707 LDKOpenChannel this_ptr_conv;
16708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16709 this_ptr_conv.is_owned = false;
16710 LDKPublicKey val_ref;
16711 CHECK((*env)->GetArrayLength(env, val) == 33);
16712 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16713 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16716 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
16717 LDKOpenChannel this_ptr_conv;
16718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16719 this_ptr_conv.is_owned = false;
16720 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
16725 LDKOpenChannel this_ptr_conv;
16726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16727 this_ptr_conv.is_owned = false;
16728 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16732 LDKOpenChannel orig_conv;
16733 orig_conv.inner = (void*)(orig & (~1));
16734 orig_conv.is_owned = false;
16735 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16738 uint64_t ret_ref = (uint64_t)ret_var.inner;
16739 if (ret_var.is_owned) {
16745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16746 LDKAcceptChannel this_obj_conv;
16747 this_obj_conv.inner = (void*)(this_obj & (~1));
16748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16749 AcceptChannel_free(this_obj_conv);
16752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16753 LDKAcceptChannel this_ptr_conv;
16754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16755 this_ptr_conv.is_owned = false;
16756 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16757 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
16761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16762 LDKAcceptChannel this_ptr_conv;
16763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16764 this_ptr_conv.is_owned = false;
16765 LDKThirtyTwoBytes val_ref;
16766 CHECK((*env)->GetArrayLength(env, val) == 32);
16767 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16768 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16772 LDKAcceptChannel this_ptr_conv;
16773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16774 this_ptr_conv.is_owned = false;
16775 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16780 LDKAcceptChannel this_ptr_conv;
16781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16782 this_ptr_conv.is_owned = false;
16783 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16786 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) {
16787 LDKAcceptChannel this_ptr_conv;
16788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16789 this_ptr_conv.is_owned = false;
16790 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16794 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) {
16795 LDKAcceptChannel this_ptr_conv;
16796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16797 this_ptr_conv.is_owned = false;
16798 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16802 LDKAcceptChannel this_ptr_conv;
16803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16804 this_ptr_conv.is_owned = false;
16805 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16810 LDKAcceptChannel this_ptr_conv;
16811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16812 this_ptr_conv.is_owned = false;
16813 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16817 LDKAcceptChannel this_ptr_conv;
16818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16819 this_ptr_conv.is_owned = false;
16820 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16825 LDKAcceptChannel this_ptr_conv;
16826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16827 this_ptr_conv.is_owned = false;
16828 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16831 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16832 LDKAcceptChannel this_ptr_conv;
16833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16834 this_ptr_conv.is_owned = false;
16835 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16840 LDKAcceptChannel this_ptr_conv;
16841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16842 this_ptr_conv.is_owned = false;
16843 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16846 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16847 LDKAcceptChannel this_ptr_conv;
16848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16849 this_ptr_conv.is_owned = false;
16850 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16855 LDKAcceptChannel this_ptr_conv;
16856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16857 this_ptr_conv.is_owned = false;
16858 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16861 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16862 LDKAcceptChannel this_ptr_conv;
16863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16864 this_ptr_conv.is_owned = false;
16865 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16870 LDKAcceptChannel this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16877 LDKAcceptChannel this_ptr_conv;
16878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16879 this_ptr_conv.is_owned = false;
16880 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16881 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16886 LDKAcceptChannel this_ptr_conv;
16887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16888 this_ptr_conv.is_owned = false;
16889 LDKPublicKey val_ref;
16890 CHECK((*env)->GetArrayLength(env, val) == 33);
16891 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16892 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16896 LDKAcceptChannel this_ptr_conv;
16897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16898 this_ptr_conv.is_owned = false;
16899 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16900 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16905 LDKAcceptChannel this_ptr_conv;
16906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16907 this_ptr_conv.is_owned = false;
16908 LDKPublicKey val_ref;
16909 CHECK((*env)->GetArrayLength(env, val) == 33);
16910 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16911 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16915 LDKAcceptChannel this_ptr_conv;
16916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16917 this_ptr_conv.is_owned = false;
16918 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
16923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16924 LDKAcceptChannel this_ptr_conv;
16925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16926 this_ptr_conv.is_owned = false;
16927 LDKPublicKey val_ref;
16928 CHECK((*env)->GetArrayLength(env, val) == 33);
16929 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16930 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16934 LDKAcceptChannel this_ptr_conv;
16935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16936 this_ptr_conv.is_owned = false;
16937 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16938 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16943 LDKAcceptChannel this_ptr_conv;
16944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16945 this_ptr_conv.is_owned = false;
16946 LDKPublicKey val_ref;
16947 CHECK((*env)->GetArrayLength(env, val) == 33);
16948 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16949 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16953 LDKAcceptChannel this_ptr_conv;
16954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16955 this_ptr_conv.is_owned = false;
16956 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16962 LDKAcceptChannel this_ptr_conv;
16963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16964 this_ptr_conv.is_owned = false;
16965 LDKPublicKey val_ref;
16966 CHECK((*env)->GetArrayLength(env, val) == 33);
16967 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16968 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16972 LDKAcceptChannel this_ptr_conv;
16973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16974 this_ptr_conv.is_owned = false;
16975 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16980 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) {
16981 LDKAcceptChannel this_ptr_conv;
16982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16983 this_ptr_conv.is_owned = false;
16984 LDKPublicKey val_ref;
16985 CHECK((*env)->GetArrayLength(env, val) == 33);
16986 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16987 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16991 LDKAcceptChannel orig_conv;
16992 orig_conv.inner = (void*)(orig & (~1));
16993 orig_conv.is_owned = false;
16994 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16997 uint64_t ret_ref = (uint64_t)ret_var.inner;
16998 if (ret_var.is_owned) {
17004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17005 LDKFundingCreated this_obj_conv;
17006 this_obj_conv.inner = (void*)(this_obj & (~1));
17007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17008 FundingCreated_free(this_obj_conv);
17011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17012 LDKFundingCreated this_ptr_conv;
17013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17014 this_ptr_conv.is_owned = false;
17015 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17016 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17021 LDKFundingCreated this_ptr_conv;
17022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17023 this_ptr_conv.is_owned = false;
17024 LDKThirtyTwoBytes val_ref;
17025 CHECK((*env)->GetArrayLength(env, val) == 32);
17026 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17027 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17031 LDKFundingCreated this_ptr_conv;
17032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17033 this_ptr_conv.is_owned = false;
17034 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17040 LDKFundingCreated this_ptr_conv;
17041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17042 this_ptr_conv.is_owned = false;
17043 LDKThirtyTwoBytes val_ref;
17044 CHECK((*env)->GetArrayLength(env, val) == 32);
17045 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17046 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17049 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17050 LDKFundingCreated this_ptr_conv;
17051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17052 this_ptr_conv.is_owned = false;
17053 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17058 LDKFundingCreated this_ptr_conv;
17059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17060 this_ptr_conv.is_owned = false;
17061 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17065 LDKFundingCreated this_ptr_conv;
17066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17067 this_ptr_conv.is_owned = false;
17068 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17069 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17074 LDKFundingCreated this_ptr_conv;
17075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17076 this_ptr_conv.is_owned = false;
17077 LDKSignature val_ref;
17078 CHECK((*env)->GetArrayLength(env, val) == 64);
17079 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17080 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17083 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) {
17084 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17085 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17086 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17087 LDKThirtyTwoBytes funding_txid_arg_ref;
17088 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17089 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17090 LDKSignature signature_arg_ref;
17091 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17092 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17093 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17096 uint64_t ret_ref = (uint64_t)ret_var.inner;
17097 if (ret_var.is_owned) {
17103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17104 LDKFundingCreated orig_conv;
17105 orig_conv.inner = (void*)(orig & (~1));
17106 orig_conv.is_owned = false;
17107 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17110 uint64_t ret_ref = (uint64_t)ret_var.inner;
17111 if (ret_var.is_owned) {
17117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17118 LDKFundingSigned this_obj_conv;
17119 this_obj_conv.inner = (void*)(this_obj & (~1));
17120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17121 FundingSigned_free(this_obj_conv);
17124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17125 LDKFundingSigned this_ptr_conv;
17126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17127 this_ptr_conv.is_owned = false;
17128 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17129 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17134 LDKFundingSigned this_ptr_conv;
17135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17136 this_ptr_conv.is_owned = false;
17137 LDKThirtyTwoBytes val_ref;
17138 CHECK((*env)->GetArrayLength(env, val) == 32);
17139 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17140 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17144 LDKFundingSigned this_ptr_conv;
17145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17146 this_ptr_conv.is_owned = false;
17147 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17153 LDKFundingSigned this_ptr_conv;
17154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17155 this_ptr_conv.is_owned = false;
17156 LDKSignature val_ref;
17157 CHECK((*env)->GetArrayLength(env, val) == 64);
17158 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17159 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17163 LDKThirtyTwoBytes channel_id_arg_ref;
17164 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17165 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17166 LDKSignature signature_arg_ref;
17167 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17168 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17169 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17172 uint64_t ret_ref = (uint64_t)ret_var.inner;
17173 if (ret_var.is_owned) {
17179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17180 LDKFundingSigned orig_conv;
17181 orig_conv.inner = (void*)(orig & (~1));
17182 orig_conv.is_owned = false;
17183 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17186 uint64_t ret_ref = (uint64_t)ret_var.inner;
17187 if (ret_var.is_owned) {
17193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17194 LDKFundingLocked this_obj_conv;
17195 this_obj_conv.inner = (void*)(this_obj & (~1));
17196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17197 FundingLocked_free(this_obj_conv);
17200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17201 LDKFundingLocked this_ptr_conv;
17202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17203 this_ptr_conv.is_owned = false;
17204 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17205 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17210 LDKFundingLocked this_ptr_conv;
17211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17212 this_ptr_conv.is_owned = false;
17213 LDKThirtyTwoBytes val_ref;
17214 CHECK((*env)->GetArrayLength(env, val) == 32);
17215 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17216 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17220 LDKFundingLocked this_ptr_conv;
17221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17222 this_ptr_conv.is_owned = false;
17223 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17224 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17228 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) {
17229 LDKFundingLocked this_ptr_conv;
17230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17231 this_ptr_conv.is_owned = false;
17232 LDKPublicKey val_ref;
17233 CHECK((*env)->GetArrayLength(env, val) == 33);
17234 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17235 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17238 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) {
17239 LDKThirtyTwoBytes channel_id_arg_ref;
17240 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17241 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17242 LDKPublicKey next_per_commitment_point_arg_ref;
17243 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17244 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17245 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17248 uint64_t ret_ref = (uint64_t)ret_var.inner;
17249 if (ret_var.is_owned) {
17255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17256 LDKFundingLocked orig_conv;
17257 orig_conv.inner = (void*)(orig & (~1));
17258 orig_conv.is_owned = false;
17259 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17262 uint64_t ret_ref = (uint64_t)ret_var.inner;
17263 if (ret_var.is_owned) {
17269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17270 LDKShutdown this_obj_conv;
17271 this_obj_conv.inner = (void*)(this_obj & (~1));
17272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17273 Shutdown_free(this_obj_conv);
17276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17277 LDKShutdown this_ptr_conv;
17278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17279 this_ptr_conv.is_owned = false;
17280 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17281 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17286 LDKShutdown this_ptr_conv;
17287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17288 this_ptr_conv.is_owned = false;
17289 LDKThirtyTwoBytes val_ref;
17290 CHECK((*env)->GetArrayLength(env, val) == 32);
17291 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17292 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17296 LDKShutdown this_ptr_conv;
17297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17298 this_ptr_conv.is_owned = false;
17299 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17300 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17301 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17306 LDKShutdown this_ptr_conv;
17307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17308 this_ptr_conv.is_owned = false;
17309 LDKCVec_u8Z val_ref;
17310 val_ref.datalen = (*env)->GetArrayLength(env, val);
17311 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17312 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17313 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17317 LDKThirtyTwoBytes channel_id_arg_ref;
17318 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17319 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17320 LDKCVec_u8Z scriptpubkey_arg_ref;
17321 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17322 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17323 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17324 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17327 uint64_t ret_ref = (uint64_t)ret_var.inner;
17328 if (ret_var.is_owned) {
17334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17335 LDKShutdown orig_conv;
17336 orig_conv.inner = (void*)(orig & (~1));
17337 orig_conv.is_owned = false;
17338 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17341 uint64_t ret_ref = (uint64_t)ret_var.inner;
17342 if (ret_var.is_owned) {
17348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17349 LDKClosingSigned this_obj_conv;
17350 this_obj_conv.inner = (void*)(this_obj & (~1));
17351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17352 ClosingSigned_free(this_obj_conv);
17355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17356 LDKClosingSigned this_ptr_conv;
17357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17358 this_ptr_conv.is_owned = false;
17359 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17360 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17365 LDKClosingSigned this_ptr_conv;
17366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17367 this_ptr_conv.is_owned = false;
17368 LDKThirtyTwoBytes val_ref;
17369 CHECK((*env)->GetArrayLength(env, val) == 32);
17370 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17371 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17375 LDKClosingSigned this_ptr_conv;
17376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17377 this_ptr_conv.is_owned = false;
17378 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17383 LDKClosingSigned this_ptr_conv;
17384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17385 this_ptr_conv.is_owned = false;
17386 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17390 LDKClosingSigned this_ptr_conv;
17391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17392 this_ptr_conv.is_owned = false;
17393 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17394 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17399 LDKClosingSigned this_ptr_conv;
17400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17401 this_ptr_conv.is_owned = false;
17402 LDKSignature val_ref;
17403 CHECK((*env)->GetArrayLength(env, val) == 64);
17404 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17405 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17408 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) {
17409 LDKThirtyTwoBytes channel_id_arg_ref;
17410 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17411 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17412 LDKSignature signature_arg_ref;
17413 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17414 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17415 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17418 uint64_t ret_ref = (uint64_t)ret_var.inner;
17419 if (ret_var.is_owned) {
17425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17426 LDKClosingSigned orig_conv;
17427 orig_conv.inner = (void*)(orig & (~1));
17428 orig_conv.is_owned = false;
17429 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17432 uint64_t ret_ref = (uint64_t)ret_var.inner;
17433 if (ret_var.is_owned) {
17439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17440 LDKUpdateAddHTLC this_obj_conv;
17441 this_obj_conv.inner = (void*)(this_obj & (~1));
17442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17443 UpdateAddHTLC_free(this_obj_conv);
17446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17447 LDKUpdateAddHTLC this_ptr_conv;
17448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17449 this_ptr_conv.is_owned = false;
17450 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17451 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17456 LDKUpdateAddHTLC this_ptr_conv;
17457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17458 this_ptr_conv.is_owned = false;
17459 LDKThirtyTwoBytes val_ref;
17460 CHECK((*env)->GetArrayLength(env, val) == 32);
17461 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17462 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17466 LDKUpdateAddHTLC this_ptr_conv;
17467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17468 this_ptr_conv.is_owned = false;
17469 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17474 LDKUpdateAddHTLC this_ptr_conv;
17475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17476 this_ptr_conv.is_owned = false;
17477 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17481 LDKUpdateAddHTLC this_ptr_conv;
17482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17483 this_ptr_conv.is_owned = false;
17484 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17489 LDKUpdateAddHTLC this_ptr_conv;
17490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17491 this_ptr_conv.is_owned = false;
17492 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17496 LDKUpdateAddHTLC this_ptr_conv;
17497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17498 this_ptr_conv.is_owned = false;
17499 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17500 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17505 LDKUpdateAddHTLC this_ptr_conv;
17506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17507 this_ptr_conv.is_owned = false;
17508 LDKThirtyTwoBytes val_ref;
17509 CHECK((*env)->GetArrayLength(env, val) == 32);
17510 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17511 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17514 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17515 LDKUpdateAddHTLC this_ptr_conv;
17516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17517 this_ptr_conv.is_owned = false;
17518 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17523 LDKUpdateAddHTLC this_ptr_conv;
17524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17525 this_ptr_conv.is_owned = false;
17526 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17530 LDKUpdateAddHTLC orig_conv;
17531 orig_conv.inner = (void*)(orig & (~1));
17532 orig_conv.is_owned = false;
17533 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17536 uint64_t ret_ref = (uint64_t)ret_var.inner;
17537 if (ret_var.is_owned) {
17543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17544 LDKUpdateFulfillHTLC this_obj_conv;
17545 this_obj_conv.inner = (void*)(this_obj & (~1));
17546 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17547 UpdateFulfillHTLC_free(this_obj_conv);
17550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17551 LDKUpdateFulfillHTLC this_ptr_conv;
17552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17553 this_ptr_conv.is_owned = false;
17554 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17555 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17560 LDKUpdateFulfillHTLC this_ptr_conv;
17561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17562 this_ptr_conv.is_owned = false;
17563 LDKThirtyTwoBytes val_ref;
17564 CHECK((*env)->GetArrayLength(env, val) == 32);
17565 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17566 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17570 LDKUpdateFulfillHTLC this_ptr_conv;
17571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17572 this_ptr_conv.is_owned = false;
17573 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17578 LDKUpdateFulfillHTLC this_ptr_conv;
17579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17580 this_ptr_conv.is_owned = false;
17581 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17585 LDKUpdateFulfillHTLC this_ptr_conv;
17586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17587 this_ptr_conv.is_owned = false;
17588 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17594 LDKUpdateFulfillHTLC this_ptr_conv;
17595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17596 this_ptr_conv.is_owned = false;
17597 LDKThirtyTwoBytes val_ref;
17598 CHECK((*env)->GetArrayLength(env, val) == 32);
17599 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17600 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17603 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) {
17604 LDKThirtyTwoBytes channel_id_arg_ref;
17605 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17606 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17607 LDKThirtyTwoBytes payment_preimage_arg_ref;
17608 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17609 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17610 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17613 uint64_t ret_ref = (uint64_t)ret_var.inner;
17614 if (ret_var.is_owned) {
17620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17621 LDKUpdateFulfillHTLC orig_conv;
17622 orig_conv.inner = (void*)(orig & (~1));
17623 orig_conv.is_owned = false;
17624 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17627 uint64_t ret_ref = (uint64_t)ret_var.inner;
17628 if (ret_var.is_owned) {
17634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17635 LDKUpdateFailHTLC this_obj_conv;
17636 this_obj_conv.inner = (void*)(this_obj & (~1));
17637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17638 UpdateFailHTLC_free(this_obj_conv);
17641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17642 LDKUpdateFailHTLC this_ptr_conv;
17643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17644 this_ptr_conv.is_owned = false;
17645 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17646 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17651 LDKUpdateFailHTLC this_ptr_conv;
17652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17653 this_ptr_conv.is_owned = false;
17654 LDKThirtyTwoBytes val_ref;
17655 CHECK((*env)->GetArrayLength(env, val) == 32);
17656 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17657 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17661 LDKUpdateFailHTLC this_ptr_conv;
17662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17663 this_ptr_conv.is_owned = false;
17664 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17669 LDKUpdateFailHTLC this_ptr_conv;
17670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17671 this_ptr_conv.is_owned = false;
17672 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17676 LDKUpdateFailHTLC orig_conv;
17677 orig_conv.inner = (void*)(orig & (~1));
17678 orig_conv.is_owned = false;
17679 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17682 uint64_t ret_ref = (uint64_t)ret_var.inner;
17683 if (ret_var.is_owned) {
17689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17690 LDKUpdateFailMalformedHTLC this_obj_conv;
17691 this_obj_conv.inner = (void*)(this_obj & (~1));
17692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17693 UpdateFailMalformedHTLC_free(this_obj_conv);
17696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17697 LDKUpdateFailMalformedHTLC this_ptr_conv;
17698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17699 this_ptr_conv.is_owned = false;
17700 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17701 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
17705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17706 LDKUpdateFailMalformedHTLC this_ptr_conv;
17707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17708 this_ptr_conv.is_owned = false;
17709 LDKThirtyTwoBytes val_ref;
17710 CHECK((*env)->GetArrayLength(env, val) == 32);
17711 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17712 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17716 LDKUpdateFailMalformedHTLC this_ptr_conv;
17717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17718 this_ptr_conv.is_owned = false;
17719 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17724 LDKUpdateFailMalformedHTLC this_ptr_conv;
17725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17726 this_ptr_conv.is_owned = false;
17727 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17730 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
17731 LDKUpdateFailMalformedHTLC this_ptr_conv;
17732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17733 this_ptr_conv.is_owned = false;
17734 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17739 LDKUpdateFailMalformedHTLC this_ptr_conv;
17740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17741 this_ptr_conv.is_owned = false;
17742 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17746 LDKUpdateFailMalformedHTLC orig_conv;
17747 orig_conv.inner = (void*)(orig & (~1));
17748 orig_conv.is_owned = false;
17749 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17752 uint64_t ret_ref = (uint64_t)ret_var.inner;
17753 if (ret_var.is_owned) {
17759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17760 LDKCommitmentSigned this_obj_conv;
17761 this_obj_conv.inner = (void*)(this_obj & (~1));
17762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17763 CommitmentSigned_free(this_obj_conv);
17766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17767 LDKCommitmentSigned this_ptr_conv;
17768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17769 this_ptr_conv.is_owned = false;
17770 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17771 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
17775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17776 LDKCommitmentSigned this_ptr_conv;
17777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17778 this_ptr_conv.is_owned = false;
17779 LDKThirtyTwoBytes val_ref;
17780 CHECK((*env)->GetArrayLength(env, val) == 32);
17781 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17782 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17786 LDKCommitmentSigned this_ptr_conv;
17787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17788 this_ptr_conv.is_owned = false;
17789 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
17794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17795 LDKCommitmentSigned this_ptr_conv;
17796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17797 this_ptr_conv.is_owned = false;
17798 LDKSignature val_ref;
17799 CHECK((*env)->GetArrayLength(env, val) == 64);
17800 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17801 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17805 LDKCommitmentSigned this_ptr_conv;
17806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17807 this_ptr_conv.is_owned = false;
17808 LDKCVec_SignatureZ val_constr;
17809 val_constr.datalen = (*env)->GetArrayLength(env, val);
17810 if (val_constr.datalen > 0)
17811 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17813 val_constr.data = NULL;
17814 for (size_t i = 0; i < val_constr.datalen; i++) {
17815 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
17816 LDKSignature val_conv_8_ref;
17817 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
17818 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
17819 val_constr.data[i] = val_conv_8_ref;
17821 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17824 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) {
17825 LDKThirtyTwoBytes channel_id_arg_ref;
17826 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17827 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17828 LDKSignature signature_arg_ref;
17829 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17830 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17831 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17832 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
17833 if (htlc_signatures_arg_constr.datalen > 0)
17834 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17836 htlc_signatures_arg_constr.data = NULL;
17837 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
17838 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
17839 LDKSignature htlc_signatures_arg_conv_8_ref;
17840 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
17841 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
17842 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
17844 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17847 uint64_t ret_ref = (uint64_t)ret_var.inner;
17848 if (ret_var.is_owned) {
17854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17855 LDKCommitmentSigned orig_conv;
17856 orig_conv.inner = (void*)(orig & (~1));
17857 orig_conv.is_owned = false;
17858 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17861 uint64_t ret_ref = (uint64_t)ret_var.inner;
17862 if (ret_var.is_owned) {
17868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17869 LDKRevokeAndACK this_obj_conv;
17870 this_obj_conv.inner = (void*)(this_obj & (~1));
17871 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17872 RevokeAndACK_free(this_obj_conv);
17875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17876 LDKRevokeAndACK this_ptr_conv;
17877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17878 this_ptr_conv.is_owned = false;
17879 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17880 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
17884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17885 LDKRevokeAndACK this_ptr_conv;
17886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17887 this_ptr_conv.is_owned = false;
17888 LDKThirtyTwoBytes val_ref;
17889 CHECK((*env)->GetArrayLength(env, val) == 32);
17890 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17891 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
17895 LDKRevokeAndACK this_ptr_conv;
17896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17897 this_ptr_conv.is_owned = false;
17898 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17899 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
17903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17904 LDKRevokeAndACK this_ptr_conv;
17905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17906 this_ptr_conv.is_owned = false;
17907 LDKThirtyTwoBytes val_ref;
17908 CHECK((*env)->GetArrayLength(env, val) == 32);
17909 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17910 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17914 LDKRevokeAndACK this_ptr_conv;
17915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17916 this_ptr_conv.is_owned = false;
17917 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17918 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17922 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) {
17923 LDKRevokeAndACK this_ptr_conv;
17924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17925 this_ptr_conv.is_owned = false;
17926 LDKPublicKey val_ref;
17927 CHECK((*env)->GetArrayLength(env, val) == 33);
17928 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17929 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17932 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) {
17933 LDKThirtyTwoBytes channel_id_arg_ref;
17934 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17935 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17936 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17937 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
17938 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
17939 LDKPublicKey next_per_commitment_point_arg_ref;
17940 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17941 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17942 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17945 uint64_t ret_ref = (uint64_t)ret_var.inner;
17946 if (ret_var.is_owned) {
17952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17953 LDKRevokeAndACK orig_conv;
17954 orig_conv.inner = (void*)(orig & (~1));
17955 orig_conv.is_owned = false;
17956 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17959 uint64_t ret_ref = (uint64_t)ret_var.inner;
17960 if (ret_var.is_owned) {
17966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17967 LDKUpdateFee this_obj_conv;
17968 this_obj_conv.inner = (void*)(this_obj & (~1));
17969 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17970 UpdateFee_free(this_obj_conv);
17973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17974 LDKUpdateFee this_ptr_conv;
17975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17976 this_ptr_conv.is_owned = false;
17977 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17978 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
17982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17983 LDKUpdateFee this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 LDKThirtyTwoBytes val_ref;
17987 CHECK((*env)->GetArrayLength(env, val) == 32);
17988 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17989 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17992 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
17993 LDKUpdateFee this_ptr_conv;
17994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17995 this_ptr_conv.is_owned = false;
17996 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18001 LDKUpdateFee this_ptr_conv;
18002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18003 this_ptr_conv.is_owned = false;
18004 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18007 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) {
18008 LDKThirtyTwoBytes channel_id_arg_ref;
18009 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18010 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18011 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18014 uint64_t ret_ref = (uint64_t)ret_var.inner;
18015 if (ret_var.is_owned) {
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18022 LDKUpdateFee orig_conv;
18023 orig_conv.inner = (void*)(orig & (~1));
18024 orig_conv.is_owned = false;
18025 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18028 uint64_t ret_ref = (uint64_t)ret_var.inner;
18029 if (ret_var.is_owned) {
18035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18036 LDKDataLossProtect this_obj_conv;
18037 this_obj_conv.inner = (void*)(this_obj & (~1));
18038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18039 DataLossProtect_free(this_obj_conv);
18042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18043 LDKDataLossProtect this_ptr_conv;
18044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18045 this_ptr_conv.is_owned = false;
18046 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18051 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) {
18052 LDKDataLossProtect this_ptr_conv;
18053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18054 this_ptr_conv.is_owned = false;
18055 LDKThirtyTwoBytes val_ref;
18056 CHECK((*env)->GetArrayLength(env, val) == 32);
18057 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18058 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18062 LDKDataLossProtect this_ptr_conv;
18063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18064 this_ptr_conv.is_owned = false;
18065 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18070 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) {
18071 LDKDataLossProtect this_ptr_conv;
18072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18073 this_ptr_conv.is_owned = false;
18074 LDKPublicKey val_ref;
18075 CHECK((*env)->GetArrayLength(env, val) == 33);
18076 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18077 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18080 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) {
18081 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18082 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18083 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18084 LDKPublicKey my_current_per_commitment_point_arg_ref;
18085 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18086 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18087 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18090 uint64_t ret_ref = (uint64_t)ret_var.inner;
18091 if (ret_var.is_owned) {
18097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18098 LDKDataLossProtect orig_conv;
18099 orig_conv.inner = (void*)(orig & (~1));
18100 orig_conv.is_owned = false;
18101 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18104 uint64_t ret_ref = (uint64_t)ret_var.inner;
18105 if (ret_var.is_owned) {
18111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18112 LDKChannelReestablish this_obj_conv;
18113 this_obj_conv.inner = (void*)(this_obj & (~1));
18114 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18115 ChannelReestablish_free(this_obj_conv);
18118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18119 LDKChannelReestablish this_ptr_conv;
18120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18121 this_ptr_conv.is_owned = false;
18122 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18128 LDKChannelReestablish this_ptr_conv;
18129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18130 this_ptr_conv.is_owned = false;
18131 LDKThirtyTwoBytes val_ref;
18132 CHECK((*env)->GetArrayLength(env, val) == 32);
18133 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18134 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18138 LDKChannelReestablish this_ptr_conv;
18139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18140 this_ptr_conv.is_owned = false;
18141 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18145 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) {
18146 LDKChannelReestablish this_ptr_conv;
18147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18148 this_ptr_conv.is_owned = false;
18149 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18153 LDKChannelReestablish this_ptr_conv;
18154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18155 this_ptr_conv.is_owned = false;
18156 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18160 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) {
18161 LDKChannelReestablish this_ptr_conv;
18162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18163 this_ptr_conv.is_owned = false;
18164 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18168 LDKChannelReestablish orig_conv;
18169 orig_conv.inner = (void*)(orig & (~1));
18170 orig_conv.is_owned = false;
18171 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18174 uint64_t ret_ref = (uint64_t)ret_var.inner;
18175 if (ret_var.is_owned) {
18181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18182 LDKAnnouncementSignatures this_obj_conv;
18183 this_obj_conv.inner = (void*)(this_obj & (~1));
18184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18185 AnnouncementSignatures_free(this_obj_conv);
18188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18189 LDKAnnouncementSignatures this_ptr_conv;
18190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18191 this_ptr_conv.is_owned = false;
18192 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18193 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18198 LDKAnnouncementSignatures this_ptr_conv;
18199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18200 this_ptr_conv.is_owned = false;
18201 LDKThirtyTwoBytes val_ref;
18202 CHECK((*env)->GetArrayLength(env, val) == 32);
18203 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18204 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18208 LDKAnnouncementSignatures this_ptr_conv;
18209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18210 this_ptr_conv.is_owned = false;
18211 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18216 LDKAnnouncementSignatures this_ptr_conv;
18217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18218 this_ptr_conv.is_owned = false;
18219 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18223 LDKAnnouncementSignatures this_ptr_conv;
18224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18225 this_ptr_conv.is_owned = false;
18226 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18227 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18232 LDKAnnouncementSignatures this_ptr_conv;
18233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18234 this_ptr_conv.is_owned = false;
18235 LDKSignature val_ref;
18236 CHECK((*env)->GetArrayLength(env, val) == 64);
18237 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18238 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18242 LDKAnnouncementSignatures this_ptr_conv;
18243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18244 this_ptr_conv.is_owned = false;
18245 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18246 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18251 LDKAnnouncementSignatures this_ptr_conv;
18252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18253 this_ptr_conv.is_owned = false;
18254 LDKSignature val_ref;
18255 CHECK((*env)->GetArrayLength(env, val) == 64);
18256 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18257 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18260 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) {
18261 LDKThirtyTwoBytes channel_id_arg_ref;
18262 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18263 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18264 LDKSignature node_signature_arg_ref;
18265 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18266 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18267 LDKSignature bitcoin_signature_arg_ref;
18268 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18269 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18270 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18273 uint64_t ret_ref = (uint64_t)ret_var.inner;
18274 if (ret_var.is_owned) {
18280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18281 LDKAnnouncementSignatures orig_conv;
18282 orig_conv.inner = (void*)(orig & (~1));
18283 orig_conv.is_owned = false;
18284 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18287 uint64_t ret_ref = (uint64_t)ret_var.inner;
18288 if (ret_var.is_owned) {
18294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18295 if ((this_ptr & 1) != 0) return;
18296 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18297 FREE((void*)this_ptr);
18298 NetAddress_free(this_ptr_conv);
18301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18302 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18303 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18304 *ret_copy = NetAddress_clone(orig_conv);
18305 uint64_t ret_ref = (uint64_t)ret_copy;
18309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18310 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18311 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18312 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18313 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18314 CVec_u8Z_free(ret_var);
18318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18319 LDKu8slice ser_ref;
18320 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18321 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18322 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18323 *ret_conv = Result_read(ser_ref);
18324 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18325 return (uint64_t)ret_conv;
18328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18329 LDKu8slice ser_ref;
18330 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18331 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18332 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18333 *ret_conv = NetAddress_read(ser_ref);
18334 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18335 return (uint64_t)ret_conv;
18338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18339 LDKUnsignedNodeAnnouncement this_obj_conv;
18340 this_obj_conv.inner = (void*)(this_obj & (~1));
18341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18342 UnsignedNodeAnnouncement_free(this_obj_conv);
18345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18346 LDKUnsignedNodeAnnouncement this_ptr_conv;
18347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18348 this_ptr_conv.is_owned = false;
18349 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18352 uint64_t ret_ref = (uint64_t)ret_var.inner;
18353 if (ret_var.is_owned) {
18359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18360 LDKUnsignedNodeAnnouncement this_ptr_conv;
18361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18362 this_ptr_conv.is_owned = false;
18363 LDKNodeFeatures val_conv;
18364 val_conv.inner = (void*)(val & (~1));
18365 val_conv.is_owned = (val & 1) || (val == 0);
18366 val_conv = NodeFeatures_clone(&val_conv);
18367 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18370 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18371 LDKUnsignedNodeAnnouncement this_ptr_conv;
18372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18373 this_ptr_conv.is_owned = false;
18374 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18379 LDKUnsignedNodeAnnouncement this_ptr_conv;
18380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18381 this_ptr_conv.is_owned = false;
18382 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18386 LDKUnsignedNodeAnnouncement this_ptr_conv;
18387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18388 this_ptr_conv.is_owned = false;
18389 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18390 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18395 LDKUnsignedNodeAnnouncement this_ptr_conv;
18396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18397 this_ptr_conv.is_owned = false;
18398 LDKPublicKey val_ref;
18399 CHECK((*env)->GetArrayLength(env, val) == 33);
18400 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18401 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18405 LDKUnsignedNodeAnnouncement this_ptr_conv;
18406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18407 this_ptr_conv.is_owned = false;
18408 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18409 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18414 LDKUnsignedNodeAnnouncement this_ptr_conv;
18415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18416 this_ptr_conv.is_owned = false;
18417 LDKThreeBytes val_ref;
18418 CHECK((*env)->GetArrayLength(env, val) == 3);
18419 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18420 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18424 LDKUnsignedNodeAnnouncement this_ptr_conv;
18425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18426 this_ptr_conv.is_owned = false;
18427 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18428 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18433 LDKUnsignedNodeAnnouncement this_ptr_conv;
18434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18435 this_ptr_conv.is_owned = false;
18436 LDKThirtyTwoBytes val_ref;
18437 CHECK((*env)->GetArrayLength(env, val) == 32);
18438 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18439 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18443 LDKUnsignedNodeAnnouncement this_ptr_conv;
18444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18445 this_ptr_conv.is_owned = false;
18446 LDKCVec_NetAddressZ val_constr;
18447 val_constr.datalen = (*env)->GetArrayLength(env, val);
18448 if (val_constr.datalen > 0)
18449 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18451 val_constr.data = NULL;
18452 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18453 for (size_t m = 0; m < val_constr.datalen; m++) {
18454 int64_t val_conv_12 = val_vals[m];
18455 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18456 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18457 val_constr.data[m] = val_conv_12_conv;
18459 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18460 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18464 LDKUnsignedNodeAnnouncement orig_conv;
18465 orig_conv.inner = (void*)(orig & (~1));
18466 orig_conv.is_owned = false;
18467 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18470 uint64_t ret_ref = (uint64_t)ret_var.inner;
18471 if (ret_var.is_owned) {
18477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18478 LDKNodeAnnouncement this_obj_conv;
18479 this_obj_conv.inner = (void*)(this_obj & (~1));
18480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18481 NodeAnnouncement_free(this_obj_conv);
18484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18485 LDKNodeAnnouncement this_ptr_conv;
18486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18487 this_ptr_conv.is_owned = false;
18488 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18494 LDKNodeAnnouncement this_ptr_conv;
18495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18496 this_ptr_conv.is_owned = false;
18497 LDKSignature val_ref;
18498 CHECK((*env)->GetArrayLength(env, val) == 64);
18499 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18500 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18504 LDKNodeAnnouncement this_ptr_conv;
18505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18506 this_ptr_conv.is_owned = false;
18507 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18510 uint64_t ret_ref = (uint64_t)ret_var.inner;
18511 if (ret_var.is_owned) {
18517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18518 LDKNodeAnnouncement this_ptr_conv;
18519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18520 this_ptr_conv.is_owned = false;
18521 LDKUnsignedNodeAnnouncement val_conv;
18522 val_conv.inner = (void*)(val & (~1));
18523 val_conv.is_owned = (val & 1) || (val == 0);
18524 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18525 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18529 LDKSignature signature_arg_ref;
18530 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18531 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18532 LDKUnsignedNodeAnnouncement contents_arg_conv;
18533 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18534 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18535 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18536 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18539 uint64_t ret_ref = (uint64_t)ret_var.inner;
18540 if (ret_var.is_owned) {
18546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18547 LDKNodeAnnouncement orig_conv;
18548 orig_conv.inner = (void*)(orig & (~1));
18549 orig_conv.is_owned = false;
18550 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18553 uint64_t ret_ref = (uint64_t)ret_var.inner;
18554 if (ret_var.is_owned) {
18560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18561 LDKUnsignedChannelAnnouncement this_obj_conv;
18562 this_obj_conv.inner = (void*)(this_obj & (~1));
18563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18564 UnsignedChannelAnnouncement_free(this_obj_conv);
18567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18568 LDKUnsignedChannelAnnouncement this_ptr_conv;
18569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18570 this_ptr_conv.is_owned = false;
18571 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18574 uint64_t ret_ref = (uint64_t)ret_var.inner;
18575 if (ret_var.is_owned) {
18581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18582 LDKUnsignedChannelAnnouncement this_ptr_conv;
18583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18584 this_ptr_conv.is_owned = false;
18585 LDKChannelFeatures val_conv;
18586 val_conv.inner = (void*)(val & (~1));
18587 val_conv.is_owned = (val & 1) || (val == 0);
18588 val_conv = ChannelFeatures_clone(&val_conv);
18589 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18593 LDKUnsignedChannelAnnouncement this_ptr_conv;
18594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18595 this_ptr_conv.is_owned = false;
18596 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18602 LDKUnsignedChannelAnnouncement this_ptr_conv;
18603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18604 this_ptr_conv.is_owned = false;
18605 LDKThirtyTwoBytes val_ref;
18606 CHECK((*env)->GetArrayLength(env, val) == 32);
18607 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18608 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18612 LDKUnsignedChannelAnnouncement this_ptr_conv;
18613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18614 this_ptr_conv.is_owned = false;
18615 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18620 LDKUnsignedChannelAnnouncement this_ptr_conv;
18621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18622 this_ptr_conv.is_owned = false;
18623 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18627 LDKUnsignedChannelAnnouncement this_ptr_conv;
18628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18629 this_ptr_conv.is_owned = false;
18630 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18636 LDKUnsignedChannelAnnouncement this_ptr_conv;
18637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18638 this_ptr_conv.is_owned = false;
18639 LDKPublicKey val_ref;
18640 CHECK((*env)->GetArrayLength(env, val) == 33);
18641 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18642 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18646 LDKUnsignedChannelAnnouncement this_ptr_conv;
18647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18648 this_ptr_conv.is_owned = false;
18649 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18650 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18655 LDKUnsignedChannelAnnouncement this_ptr_conv;
18656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18657 this_ptr_conv.is_owned = false;
18658 LDKPublicKey val_ref;
18659 CHECK((*env)->GetArrayLength(env, val) == 33);
18660 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18661 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18665 LDKUnsignedChannelAnnouncement this_ptr_conv;
18666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18667 this_ptr_conv.is_owned = false;
18668 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18669 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18674 LDKUnsignedChannelAnnouncement this_ptr_conv;
18675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18676 this_ptr_conv.is_owned = false;
18677 LDKPublicKey val_ref;
18678 CHECK((*env)->GetArrayLength(env, val) == 33);
18679 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18680 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18684 LDKUnsignedChannelAnnouncement this_ptr_conv;
18685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18686 this_ptr_conv.is_owned = false;
18687 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18688 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18693 LDKUnsignedChannelAnnouncement this_ptr_conv;
18694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18695 this_ptr_conv.is_owned = false;
18696 LDKPublicKey val_ref;
18697 CHECK((*env)->GetArrayLength(env, val) == 33);
18698 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18699 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18703 LDKUnsignedChannelAnnouncement orig_conv;
18704 orig_conv.inner = (void*)(orig & (~1));
18705 orig_conv.is_owned = false;
18706 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18709 uint64_t ret_ref = (uint64_t)ret_var.inner;
18710 if (ret_var.is_owned) {
18716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18717 LDKChannelAnnouncement this_obj_conv;
18718 this_obj_conv.inner = (void*)(this_obj & (~1));
18719 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18720 ChannelAnnouncement_free(this_obj_conv);
18723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18724 LDKChannelAnnouncement this_ptr_conv;
18725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18726 this_ptr_conv.is_owned = false;
18727 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18728 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
18732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18733 LDKChannelAnnouncement this_ptr_conv;
18734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18735 this_ptr_conv.is_owned = false;
18736 LDKSignature val_ref;
18737 CHECK((*env)->GetArrayLength(env, val) == 64);
18738 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18739 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18743 LDKChannelAnnouncement this_ptr_conv;
18744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18745 this_ptr_conv.is_owned = false;
18746 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18747 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
18751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18752 LDKChannelAnnouncement this_ptr_conv;
18753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18754 this_ptr_conv.is_owned = false;
18755 LDKSignature val_ref;
18756 CHECK((*env)->GetArrayLength(env, val) == 64);
18757 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18758 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18762 LDKChannelAnnouncement this_ptr_conv;
18763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18764 this_ptr_conv.is_owned = false;
18765 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
18770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18771 LDKChannelAnnouncement this_ptr_conv;
18772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18773 this_ptr_conv.is_owned = false;
18774 LDKSignature val_ref;
18775 CHECK((*env)->GetArrayLength(env, val) == 64);
18776 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18777 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18781 LDKChannelAnnouncement this_ptr_conv;
18782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18783 this_ptr_conv.is_owned = false;
18784 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18785 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
18789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18790 LDKChannelAnnouncement this_ptr_conv;
18791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18792 this_ptr_conv.is_owned = false;
18793 LDKSignature val_ref;
18794 CHECK((*env)->GetArrayLength(env, val) == 64);
18795 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18796 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18800 LDKChannelAnnouncement this_ptr_conv;
18801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18802 this_ptr_conv.is_owned = false;
18803 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18806 uint64_t ret_ref = (uint64_t)ret_var.inner;
18807 if (ret_var.is_owned) {
18813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18814 LDKChannelAnnouncement this_ptr_conv;
18815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18816 this_ptr_conv.is_owned = false;
18817 LDKUnsignedChannelAnnouncement val_conv;
18818 val_conv.inner = (void*)(val & (~1));
18819 val_conv.is_owned = (val & 1) || (val == 0);
18820 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18821 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18824 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) {
18825 LDKSignature node_signature_1_arg_ref;
18826 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
18827 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
18828 LDKSignature node_signature_2_arg_ref;
18829 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
18830 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
18831 LDKSignature bitcoin_signature_1_arg_ref;
18832 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
18833 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
18834 LDKSignature bitcoin_signature_2_arg_ref;
18835 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
18836 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
18837 LDKUnsignedChannelAnnouncement contents_arg_conv;
18838 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18839 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18840 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18841 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);
18842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18844 uint64_t ret_ref = (uint64_t)ret_var.inner;
18845 if (ret_var.is_owned) {
18851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18852 LDKChannelAnnouncement orig_conv;
18853 orig_conv.inner = (void*)(orig & (~1));
18854 orig_conv.is_owned = false;
18855 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18858 uint64_t ret_ref = (uint64_t)ret_var.inner;
18859 if (ret_var.is_owned) {
18865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18866 LDKUnsignedChannelUpdate this_obj_conv;
18867 this_obj_conv.inner = (void*)(this_obj & (~1));
18868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18869 UnsignedChannelUpdate_free(this_obj_conv);
18872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18873 LDKUnsignedChannelUpdate this_ptr_conv;
18874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18875 this_ptr_conv.is_owned = false;
18876 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18877 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
18881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18882 LDKUnsignedChannelUpdate this_ptr_conv;
18883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18884 this_ptr_conv.is_owned = false;
18885 LDKThirtyTwoBytes val_ref;
18886 CHECK((*env)->GetArrayLength(env, val) == 32);
18887 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18888 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18892 LDKUnsignedChannelUpdate this_ptr_conv;
18893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18894 this_ptr_conv.is_owned = false;
18895 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18900 LDKUnsignedChannelUpdate this_ptr_conv;
18901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18902 this_ptr_conv.is_owned = false;
18903 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18906 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18907 LDKUnsignedChannelUpdate this_ptr_conv;
18908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18909 this_ptr_conv.is_owned = false;
18910 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18915 LDKUnsignedChannelUpdate this_ptr_conv;
18916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18917 this_ptr_conv.is_owned = false;
18918 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18921 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18922 LDKUnsignedChannelUpdate this_ptr_conv;
18923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18924 this_ptr_conv.is_owned = false;
18925 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18930 LDKUnsignedChannelUpdate this_ptr_conv;
18931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18932 this_ptr_conv.is_owned = false;
18933 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18936 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18937 LDKUnsignedChannelUpdate this_ptr_conv;
18938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18939 this_ptr_conv.is_owned = false;
18940 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18945 LDKUnsignedChannelUpdate this_ptr_conv;
18946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18947 this_ptr_conv.is_owned = false;
18948 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18952 LDKUnsignedChannelUpdate this_ptr_conv;
18953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18954 this_ptr_conv.is_owned = false;
18955 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18960 LDKUnsignedChannelUpdate this_ptr_conv;
18961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18962 this_ptr_conv.is_owned = false;
18963 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18966 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18967 LDKUnsignedChannelUpdate this_ptr_conv;
18968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18969 this_ptr_conv.is_owned = false;
18970 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18975 LDKUnsignedChannelUpdate this_ptr_conv;
18976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18977 this_ptr_conv.is_owned = false;
18978 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
18981 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18982 LDKUnsignedChannelUpdate this_ptr_conv;
18983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18984 this_ptr_conv.is_owned = false;
18985 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
18989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18990 LDKUnsignedChannelUpdate this_ptr_conv;
18991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18992 this_ptr_conv.is_owned = false;
18993 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
18996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18997 LDKUnsignedChannelUpdate orig_conv;
18998 orig_conv.inner = (void*)(orig & (~1));
18999 orig_conv.is_owned = false;
19000 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19003 uint64_t ret_ref = (uint64_t)ret_var.inner;
19004 if (ret_var.is_owned) {
19010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19011 LDKChannelUpdate this_obj_conv;
19012 this_obj_conv.inner = (void*)(this_obj & (~1));
19013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19014 ChannelUpdate_free(this_obj_conv);
19017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19018 LDKChannelUpdate this_ptr_conv;
19019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19020 this_ptr_conv.is_owned = false;
19021 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19022 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19027 LDKChannelUpdate this_ptr_conv;
19028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19029 this_ptr_conv.is_owned = false;
19030 LDKSignature val_ref;
19031 CHECK((*env)->GetArrayLength(env, val) == 64);
19032 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19033 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19037 LDKChannelUpdate this_ptr_conv;
19038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19039 this_ptr_conv.is_owned = false;
19040 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19043 uint64_t ret_ref = (uint64_t)ret_var.inner;
19044 if (ret_var.is_owned) {
19050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19051 LDKChannelUpdate this_ptr_conv;
19052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19053 this_ptr_conv.is_owned = false;
19054 LDKUnsignedChannelUpdate val_conv;
19055 val_conv.inner = (void*)(val & (~1));
19056 val_conv.is_owned = (val & 1) || (val == 0);
19057 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19058 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19062 LDKSignature signature_arg_ref;
19063 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19064 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19065 LDKUnsignedChannelUpdate contents_arg_conv;
19066 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19067 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19068 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19069 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19072 uint64_t ret_ref = (uint64_t)ret_var.inner;
19073 if (ret_var.is_owned) {
19079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19080 LDKChannelUpdate orig_conv;
19081 orig_conv.inner = (void*)(orig & (~1));
19082 orig_conv.is_owned = false;
19083 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19086 uint64_t ret_ref = (uint64_t)ret_var.inner;
19087 if (ret_var.is_owned) {
19093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19094 LDKQueryChannelRange this_obj_conv;
19095 this_obj_conv.inner = (void*)(this_obj & (~1));
19096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19097 QueryChannelRange_free(this_obj_conv);
19100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19101 LDKQueryChannelRange this_ptr_conv;
19102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19103 this_ptr_conv.is_owned = false;
19104 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19105 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19110 LDKQueryChannelRange this_ptr_conv;
19111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19112 this_ptr_conv.is_owned = false;
19113 LDKThirtyTwoBytes val_ref;
19114 CHECK((*env)->GetArrayLength(env, val) == 32);
19115 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19116 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19120 LDKQueryChannelRange this_ptr_conv;
19121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19122 this_ptr_conv.is_owned = false;
19123 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19128 LDKQueryChannelRange this_ptr_conv;
19129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19130 this_ptr_conv.is_owned = false;
19131 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19134 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19135 LDKQueryChannelRange this_ptr_conv;
19136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19137 this_ptr_conv.is_owned = false;
19138 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19143 LDKQueryChannelRange this_ptr_conv;
19144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19145 this_ptr_conv.is_owned = false;
19146 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19149 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) {
19150 LDKThirtyTwoBytes chain_hash_arg_ref;
19151 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19152 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19153 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19156 uint64_t ret_ref = (uint64_t)ret_var.inner;
19157 if (ret_var.is_owned) {
19163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19164 LDKQueryChannelRange orig_conv;
19165 orig_conv.inner = (void*)(orig & (~1));
19166 orig_conv.is_owned = false;
19167 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19170 uint64_t ret_ref = (uint64_t)ret_var.inner;
19171 if (ret_var.is_owned) {
19177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19178 LDKReplyChannelRange this_obj_conv;
19179 this_obj_conv.inner = (void*)(this_obj & (~1));
19180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19181 ReplyChannelRange_free(this_obj_conv);
19184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19185 LDKReplyChannelRange this_ptr_conv;
19186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19187 this_ptr_conv.is_owned = false;
19188 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19189 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19194 LDKReplyChannelRange this_ptr_conv;
19195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19196 this_ptr_conv.is_owned = false;
19197 LDKThirtyTwoBytes val_ref;
19198 CHECK((*env)->GetArrayLength(env, val) == 32);
19199 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19200 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19203 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19204 LDKReplyChannelRange this_ptr_conv;
19205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19206 this_ptr_conv.is_owned = false;
19207 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19212 LDKReplyChannelRange this_ptr_conv;
19213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19214 this_ptr_conv.is_owned = false;
19215 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19218 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19219 LDKReplyChannelRange this_ptr_conv;
19220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19221 this_ptr_conv.is_owned = false;
19222 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19227 LDKReplyChannelRange this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19234 LDKReplyChannelRange this_ptr_conv;
19235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19236 this_ptr_conv.is_owned = false;
19237 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19242 LDKReplyChannelRange this_ptr_conv;
19243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19244 this_ptr_conv.is_owned = false;
19245 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19249 LDKReplyChannelRange this_ptr_conv;
19250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19251 this_ptr_conv.is_owned = false;
19252 LDKCVec_u64Z val_constr;
19253 val_constr.datalen = (*env)->GetArrayLength(env, val);
19254 if (val_constr.datalen > 0)
19255 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19257 val_constr.data = NULL;
19258 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19259 for (size_t g = 0; g < val_constr.datalen; g++) {
19260 int64_t val_conv_6 = val_vals[g];
19261 val_constr.data[g] = val_conv_6;
19263 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19264 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19267 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) {
19268 LDKThirtyTwoBytes chain_hash_arg_ref;
19269 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19270 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19271 LDKCVec_u64Z short_channel_ids_arg_constr;
19272 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19273 if (short_channel_ids_arg_constr.datalen > 0)
19274 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19276 short_channel_ids_arg_constr.data = NULL;
19277 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19278 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19279 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19280 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19282 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19283 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19286 uint64_t ret_ref = (uint64_t)ret_var.inner;
19287 if (ret_var.is_owned) {
19293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19294 LDKReplyChannelRange orig_conv;
19295 orig_conv.inner = (void*)(orig & (~1));
19296 orig_conv.is_owned = false;
19297 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19300 uint64_t ret_ref = (uint64_t)ret_var.inner;
19301 if (ret_var.is_owned) {
19307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19308 LDKQueryShortChannelIds this_obj_conv;
19309 this_obj_conv.inner = (void*)(this_obj & (~1));
19310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19311 QueryShortChannelIds_free(this_obj_conv);
19314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19315 LDKQueryShortChannelIds this_ptr_conv;
19316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19317 this_ptr_conv.is_owned = false;
19318 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19319 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19324 LDKQueryShortChannelIds this_ptr_conv;
19325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19326 this_ptr_conv.is_owned = false;
19327 LDKThirtyTwoBytes val_ref;
19328 CHECK((*env)->GetArrayLength(env, val) == 32);
19329 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19330 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19334 LDKQueryShortChannelIds this_ptr_conv;
19335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19336 this_ptr_conv.is_owned = false;
19337 LDKCVec_u64Z val_constr;
19338 val_constr.datalen = (*env)->GetArrayLength(env, val);
19339 if (val_constr.datalen > 0)
19340 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19342 val_constr.data = NULL;
19343 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19344 for (size_t g = 0; g < val_constr.datalen; g++) {
19345 int64_t val_conv_6 = val_vals[g];
19346 val_constr.data[g] = val_conv_6;
19348 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19349 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19352 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) {
19353 LDKThirtyTwoBytes chain_hash_arg_ref;
19354 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19355 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19356 LDKCVec_u64Z short_channel_ids_arg_constr;
19357 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19358 if (short_channel_ids_arg_constr.datalen > 0)
19359 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19361 short_channel_ids_arg_constr.data = NULL;
19362 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19363 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19364 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19365 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19367 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19368 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19371 uint64_t ret_ref = (uint64_t)ret_var.inner;
19372 if (ret_var.is_owned) {
19378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19379 LDKQueryShortChannelIds orig_conv;
19380 orig_conv.inner = (void*)(orig & (~1));
19381 orig_conv.is_owned = false;
19382 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19385 uint64_t ret_ref = (uint64_t)ret_var.inner;
19386 if (ret_var.is_owned) {
19392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19393 LDKReplyShortChannelIdsEnd this_obj_conv;
19394 this_obj_conv.inner = (void*)(this_obj & (~1));
19395 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19396 ReplyShortChannelIdsEnd_free(this_obj_conv);
19399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19400 LDKReplyShortChannelIdsEnd this_ptr_conv;
19401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19402 this_ptr_conv.is_owned = false;
19403 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19404 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19409 LDKReplyShortChannelIdsEnd this_ptr_conv;
19410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19411 this_ptr_conv.is_owned = false;
19412 LDKThirtyTwoBytes val_ref;
19413 CHECK((*env)->GetArrayLength(env, val) == 32);
19414 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19415 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19419 LDKReplyShortChannelIdsEnd this_ptr_conv;
19420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19421 this_ptr_conv.is_owned = false;
19422 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19427 LDKReplyShortChannelIdsEnd this_ptr_conv;
19428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19429 this_ptr_conv.is_owned = false;
19430 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19434 LDKThirtyTwoBytes chain_hash_arg_ref;
19435 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19436 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19437 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19440 uint64_t ret_ref = (uint64_t)ret_var.inner;
19441 if (ret_var.is_owned) {
19447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19448 LDKReplyShortChannelIdsEnd orig_conv;
19449 orig_conv.inner = (void*)(orig & (~1));
19450 orig_conv.is_owned = false;
19451 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19454 uint64_t ret_ref = (uint64_t)ret_var.inner;
19455 if (ret_var.is_owned) {
19461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19462 LDKGossipTimestampFilter this_obj_conv;
19463 this_obj_conv.inner = (void*)(this_obj & (~1));
19464 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19465 GossipTimestampFilter_free(this_obj_conv);
19468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19469 LDKGossipTimestampFilter this_ptr_conv;
19470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19471 this_ptr_conv.is_owned = false;
19472 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19478 LDKGossipTimestampFilter this_ptr_conv;
19479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19480 this_ptr_conv.is_owned = false;
19481 LDKThirtyTwoBytes val_ref;
19482 CHECK((*env)->GetArrayLength(env, val) == 32);
19483 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19484 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19487 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19488 LDKGossipTimestampFilter this_ptr_conv;
19489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19490 this_ptr_conv.is_owned = false;
19491 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19496 LDKGossipTimestampFilter this_ptr_conv;
19497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19498 this_ptr_conv.is_owned = false;
19499 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19502 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19503 LDKGossipTimestampFilter this_ptr_conv;
19504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19505 this_ptr_conv.is_owned = false;
19506 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19511 LDKGossipTimestampFilter this_ptr_conv;
19512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19513 this_ptr_conv.is_owned = false;
19514 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19517 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) {
19518 LDKThirtyTwoBytes chain_hash_arg_ref;
19519 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19520 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19521 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19524 uint64_t ret_ref = (uint64_t)ret_var.inner;
19525 if (ret_var.is_owned) {
19531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19532 LDKGossipTimestampFilter orig_conv;
19533 orig_conv.inner = (void*)(orig & (~1));
19534 orig_conv.is_owned = false;
19535 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19538 uint64_t ret_ref = (uint64_t)ret_var.inner;
19539 if (ret_var.is_owned) {
19545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19546 if ((this_ptr & 1) != 0) return;
19547 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19548 FREE((void*)this_ptr);
19549 ErrorAction_free(this_ptr_conv);
19552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19553 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19554 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19555 *ret_copy = ErrorAction_clone(orig_conv);
19556 uint64_t ret_ref = (uint64_t)ret_copy;
19560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19561 LDKLightningError this_obj_conv;
19562 this_obj_conv.inner = (void*)(this_obj & (~1));
19563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19564 LightningError_free(this_obj_conv);
19567 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19568 LDKLightningError this_ptr_conv;
19569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19570 this_ptr_conv.is_owned = false;
19571 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19572 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19577 LDKLightningError this_ptr_conv;
19578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19579 this_ptr_conv.is_owned = false;
19580 LDKStr val_conv = java_to_owned_str(env, val);
19581 LightningError_set_err(&this_ptr_conv, val_conv);
19584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19585 LDKLightningError this_ptr_conv;
19586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19587 this_ptr_conv.is_owned = false;
19588 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19589 *ret_copy = LightningError_get_action(&this_ptr_conv);
19590 uint64_t ret_ref = (uint64_t)ret_copy;
19594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19595 LDKLightningError this_ptr_conv;
19596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19597 this_ptr_conv.is_owned = false;
19598 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19599 LightningError_set_action(&this_ptr_conv, val_conv);
19602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19603 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19604 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19605 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19608 uint64_t ret_ref = (uint64_t)ret_var.inner;
19609 if (ret_var.is_owned) {
19615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19616 LDKLightningError orig_conv;
19617 orig_conv.inner = (void*)(orig & (~1));
19618 orig_conv.is_owned = false;
19619 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19622 uint64_t ret_ref = (uint64_t)ret_var.inner;
19623 if (ret_var.is_owned) {
19629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19630 LDKCommitmentUpdate this_obj_conv;
19631 this_obj_conv.inner = (void*)(this_obj & (~1));
19632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19633 CommitmentUpdate_free(this_obj_conv);
19636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19637 LDKCommitmentUpdate this_ptr_conv;
19638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19639 this_ptr_conv.is_owned = false;
19640 LDKCVec_UpdateAddHTLCZ val_constr;
19641 val_constr.datalen = (*env)->GetArrayLength(env, val);
19642 if (val_constr.datalen > 0)
19643 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19645 val_constr.data = NULL;
19646 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19647 for (size_t p = 0; p < val_constr.datalen; p++) {
19648 int64_t val_conv_15 = val_vals[p];
19649 LDKUpdateAddHTLC val_conv_15_conv;
19650 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19651 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19652 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19653 val_constr.data[p] = val_conv_15_conv;
19655 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19656 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19660 LDKCommitmentUpdate this_ptr_conv;
19661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19662 this_ptr_conv.is_owned = false;
19663 LDKCVec_UpdateFulfillHTLCZ val_constr;
19664 val_constr.datalen = (*env)->GetArrayLength(env, val);
19665 if (val_constr.datalen > 0)
19666 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19668 val_constr.data = NULL;
19669 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19670 for (size_t t = 0; t < val_constr.datalen; t++) {
19671 int64_t val_conv_19 = val_vals[t];
19672 LDKUpdateFulfillHTLC val_conv_19_conv;
19673 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19674 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19675 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19676 val_constr.data[t] = val_conv_19_conv;
19678 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19679 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19683 LDKCommitmentUpdate this_ptr_conv;
19684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19685 this_ptr_conv.is_owned = false;
19686 LDKCVec_UpdateFailHTLCZ val_constr;
19687 val_constr.datalen = (*env)->GetArrayLength(env, val);
19688 if (val_constr.datalen > 0)
19689 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19691 val_constr.data = NULL;
19692 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19693 for (size_t q = 0; q < val_constr.datalen; q++) {
19694 int64_t val_conv_16 = val_vals[q];
19695 LDKUpdateFailHTLC val_conv_16_conv;
19696 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19697 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19698 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19699 val_constr.data[q] = val_conv_16_conv;
19701 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19702 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19705 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) {
19706 LDKCommitmentUpdate this_ptr_conv;
19707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19708 this_ptr_conv.is_owned = false;
19709 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19710 val_constr.datalen = (*env)->GetArrayLength(env, val);
19711 if (val_constr.datalen > 0)
19712 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19714 val_constr.data = NULL;
19715 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19716 for (size_t z = 0; z < val_constr.datalen; z++) {
19717 int64_t val_conv_25 = val_vals[z];
19718 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19719 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19720 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19721 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19722 val_constr.data[z] = val_conv_25_conv;
19724 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19725 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
19729 LDKCommitmentUpdate this_ptr_conv;
19730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19731 this_ptr_conv.is_owned = false;
19732 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19743 LDKCommitmentUpdate this_ptr_conv;
19744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19745 this_ptr_conv.is_owned = false;
19746 LDKUpdateFee val_conv;
19747 val_conv.inner = (void*)(val & (~1));
19748 val_conv.is_owned = (val & 1) || (val == 0);
19749 val_conv = UpdateFee_clone(&val_conv);
19750 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
19754 LDKCommitmentUpdate this_ptr_conv;
19755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19756 this_ptr_conv.is_owned = false;
19757 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19760 uint64_t ret_ref = (uint64_t)ret_var.inner;
19761 if (ret_var.is_owned) {
19767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19768 LDKCommitmentUpdate this_ptr_conv;
19769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19770 this_ptr_conv.is_owned = false;
19771 LDKCommitmentSigned val_conv;
19772 val_conv.inner = (void*)(val & (~1));
19773 val_conv.is_owned = (val & 1) || (val == 0);
19774 val_conv = CommitmentSigned_clone(&val_conv);
19775 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19778 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) {
19779 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19780 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
19781 if (update_add_htlcs_arg_constr.datalen > 0)
19782 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19784 update_add_htlcs_arg_constr.data = NULL;
19785 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
19786 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19787 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19788 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19789 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19790 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19791 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19792 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19794 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
19795 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19796 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
19797 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19798 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19800 update_fulfill_htlcs_arg_constr.data = NULL;
19801 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
19802 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19803 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19804 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19805 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19806 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19807 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19808 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19810 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
19811 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19812 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
19813 if (update_fail_htlcs_arg_constr.datalen > 0)
19814 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19816 update_fail_htlcs_arg_constr.data = NULL;
19817 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
19818 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19819 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19820 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19821 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19822 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19823 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19824 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19826 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
19827 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19828 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
19829 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19830 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19832 update_fail_malformed_htlcs_arg_constr.data = NULL;
19833 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
19834 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19835 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19836 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19837 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19838 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);
19839 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19840 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19842 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
19843 LDKUpdateFee update_fee_arg_conv;
19844 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19845 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19846 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19847 LDKCommitmentSigned commitment_signed_arg_conv;
19848 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19849 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19850 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19851 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);
19852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19854 uint64_t ret_ref = (uint64_t)ret_var.inner;
19855 if (ret_var.is_owned) {
19861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19862 LDKCommitmentUpdate orig_conv;
19863 orig_conv.inner = (void*)(orig & (~1));
19864 orig_conv.is_owned = false;
19865 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19868 uint64_t ret_ref = (uint64_t)ret_var.inner;
19869 if (ret_var.is_owned) {
19875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19876 if ((this_ptr & 1) != 0) return;
19877 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
19878 FREE((void*)this_ptr);
19879 HTLCFailChannelUpdate_free(this_ptr_conv);
19882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19883 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
19884 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
19885 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
19886 uint64_t ret_ref = (uint64_t)ret_copy;
19890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19891 if ((this_ptr & 1) != 0) return;
19892 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
19893 FREE((void*)this_ptr);
19894 ChannelMessageHandler_free(this_ptr_conv);
19897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19898 if ((this_ptr & 1) != 0) return;
19899 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
19900 FREE((void*)this_ptr);
19901 RoutingMessageHandler_free(this_ptr_conv);
19904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
19905 LDKAcceptChannel obj_conv;
19906 obj_conv.inner = (void*)(obj & (~1));
19907 obj_conv.is_owned = false;
19908 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
19909 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19910 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19911 CVec_u8Z_free(ret_var);
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19916 LDKu8slice ser_ref;
19917 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19918 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19919 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19920 *ret_conv = AcceptChannel_read(ser_ref);
19921 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19922 return (uint64_t)ret_conv;
19925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19926 LDKAnnouncementSignatures obj_conv;
19927 obj_conv.inner = (void*)(obj & (~1));
19928 obj_conv.is_owned = false;
19929 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
19930 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19931 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19932 CVec_u8Z_free(ret_var);
19936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19937 LDKu8slice ser_ref;
19938 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19939 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19940 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19941 *ret_conv = AnnouncementSignatures_read(ser_ref);
19942 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19943 return (uint64_t)ret_conv;
19946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
19947 LDKChannelReestablish obj_conv;
19948 obj_conv.inner = (void*)(obj & (~1));
19949 obj_conv.is_owned = false;
19950 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
19951 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19952 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19953 CVec_u8Z_free(ret_var);
19957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19958 LDKu8slice ser_ref;
19959 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19960 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19961 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19962 *ret_conv = ChannelReestablish_read(ser_ref);
19963 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19964 return (uint64_t)ret_conv;
19967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19968 LDKClosingSigned obj_conv;
19969 obj_conv.inner = (void*)(obj & (~1));
19970 obj_conv.is_owned = false;
19971 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
19972 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19973 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19974 CVec_u8Z_free(ret_var);
19978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19979 LDKu8slice ser_ref;
19980 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19981 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19982 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19983 *ret_conv = ClosingSigned_read(ser_ref);
19984 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19985 return (uint64_t)ret_conv;
19988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19989 LDKCommitmentSigned obj_conv;
19990 obj_conv.inner = (void*)(obj & (~1));
19991 obj_conv.is_owned = false;
19992 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
19993 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19994 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19995 CVec_u8Z_free(ret_var);
19999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20000 LDKu8slice ser_ref;
20001 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20002 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20003 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20004 *ret_conv = CommitmentSigned_read(ser_ref);
20005 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20006 return (uint64_t)ret_conv;
20009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20010 LDKFundingCreated obj_conv;
20011 obj_conv.inner = (void*)(obj & (~1));
20012 obj_conv.is_owned = false;
20013 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20014 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20015 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20016 CVec_u8Z_free(ret_var);
20020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20021 LDKu8slice ser_ref;
20022 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20023 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20024 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20025 *ret_conv = FundingCreated_read(ser_ref);
20026 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20027 return (uint64_t)ret_conv;
20030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20031 LDKFundingSigned obj_conv;
20032 obj_conv.inner = (void*)(obj & (~1));
20033 obj_conv.is_owned = false;
20034 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20035 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20036 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20037 CVec_u8Z_free(ret_var);
20041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20042 LDKu8slice ser_ref;
20043 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20044 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20045 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20046 *ret_conv = FundingSigned_read(ser_ref);
20047 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20048 return (uint64_t)ret_conv;
20051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20052 LDKFundingLocked obj_conv;
20053 obj_conv.inner = (void*)(obj & (~1));
20054 obj_conv.is_owned = false;
20055 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20056 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20057 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20058 CVec_u8Z_free(ret_var);
20062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20063 LDKu8slice ser_ref;
20064 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20065 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20066 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20067 *ret_conv = FundingLocked_read(ser_ref);
20068 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20069 return (uint64_t)ret_conv;
20072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20074 obj_conv.inner = (void*)(obj & (~1));
20075 obj_conv.is_owned = false;
20076 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20077 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20078 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20079 CVec_u8Z_free(ret_var);
20083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20084 LDKu8slice ser_ref;
20085 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20086 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20087 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20088 *ret_conv = Init_read(ser_ref);
20089 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20090 return (uint64_t)ret_conv;
20093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20094 LDKOpenChannel obj_conv;
20095 obj_conv.inner = (void*)(obj & (~1));
20096 obj_conv.is_owned = false;
20097 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20098 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20099 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20100 CVec_u8Z_free(ret_var);
20104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20105 LDKu8slice ser_ref;
20106 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20107 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20108 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20109 *ret_conv = OpenChannel_read(ser_ref);
20110 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20111 return (uint64_t)ret_conv;
20114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20115 LDKRevokeAndACK obj_conv;
20116 obj_conv.inner = (void*)(obj & (~1));
20117 obj_conv.is_owned = false;
20118 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20119 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20120 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20121 CVec_u8Z_free(ret_var);
20125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20126 LDKu8slice ser_ref;
20127 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20128 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20129 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20130 *ret_conv = RevokeAndACK_read(ser_ref);
20131 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20132 return (uint64_t)ret_conv;
20135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20136 LDKShutdown obj_conv;
20137 obj_conv.inner = (void*)(obj & (~1));
20138 obj_conv.is_owned = false;
20139 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20140 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20141 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20142 CVec_u8Z_free(ret_var);
20146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20147 LDKu8slice ser_ref;
20148 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20149 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20150 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20151 *ret_conv = Shutdown_read(ser_ref);
20152 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20153 return (uint64_t)ret_conv;
20156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20157 LDKUpdateFailHTLC obj_conv;
20158 obj_conv.inner = (void*)(obj & (~1));
20159 obj_conv.is_owned = false;
20160 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20161 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20162 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20163 CVec_u8Z_free(ret_var);
20167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20168 LDKu8slice ser_ref;
20169 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20170 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20171 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20172 *ret_conv = UpdateFailHTLC_read(ser_ref);
20173 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20174 return (uint64_t)ret_conv;
20177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20178 LDKUpdateFailMalformedHTLC obj_conv;
20179 obj_conv.inner = (void*)(obj & (~1));
20180 obj_conv.is_owned = false;
20181 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20182 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20183 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20184 CVec_u8Z_free(ret_var);
20188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20189 LDKu8slice ser_ref;
20190 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20191 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20192 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20193 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20194 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20195 return (uint64_t)ret_conv;
20198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20199 LDKUpdateFee obj_conv;
20200 obj_conv.inner = (void*)(obj & (~1));
20201 obj_conv.is_owned = false;
20202 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20203 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20204 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20205 CVec_u8Z_free(ret_var);
20209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20210 LDKu8slice ser_ref;
20211 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20212 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20213 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20214 *ret_conv = UpdateFee_read(ser_ref);
20215 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20216 return (uint64_t)ret_conv;
20219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20220 LDKUpdateFulfillHTLC obj_conv;
20221 obj_conv.inner = (void*)(obj & (~1));
20222 obj_conv.is_owned = false;
20223 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20224 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20225 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20226 CVec_u8Z_free(ret_var);
20230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20231 LDKu8slice ser_ref;
20232 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20233 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20234 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20235 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20236 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20237 return (uint64_t)ret_conv;
20240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20241 LDKUpdateAddHTLC obj_conv;
20242 obj_conv.inner = (void*)(obj & (~1));
20243 obj_conv.is_owned = false;
20244 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20245 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20246 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20247 CVec_u8Z_free(ret_var);
20251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20252 LDKu8slice ser_ref;
20253 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20254 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20255 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20256 *ret_conv = UpdateAddHTLC_read(ser_ref);
20257 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20258 return (uint64_t)ret_conv;
20261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20263 obj_conv.inner = (void*)(obj & (~1));
20264 obj_conv.is_owned = false;
20265 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20266 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20267 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20268 CVec_u8Z_free(ret_var);
20272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20273 LDKu8slice ser_ref;
20274 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20275 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20276 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20277 *ret_conv = Ping_read(ser_ref);
20278 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20279 return (uint64_t)ret_conv;
20282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20284 obj_conv.inner = (void*)(obj & (~1));
20285 obj_conv.is_owned = false;
20286 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20287 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20288 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20289 CVec_u8Z_free(ret_var);
20293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20294 LDKu8slice ser_ref;
20295 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20296 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20297 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20298 *ret_conv = Pong_read(ser_ref);
20299 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20300 return (uint64_t)ret_conv;
20303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20304 LDKUnsignedChannelAnnouncement obj_conv;
20305 obj_conv.inner = (void*)(obj & (~1));
20306 obj_conv.is_owned = false;
20307 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20308 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20309 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20310 CVec_u8Z_free(ret_var);
20314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20315 LDKu8slice ser_ref;
20316 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20317 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20318 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20319 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20320 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20321 return (uint64_t)ret_conv;
20324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20325 LDKChannelAnnouncement obj_conv;
20326 obj_conv.inner = (void*)(obj & (~1));
20327 obj_conv.is_owned = false;
20328 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20329 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20330 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20331 CVec_u8Z_free(ret_var);
20335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20336 LDKu8slice ser_ref;
20337 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20338 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20339 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20340 *ret_conv = ChannelAnnouncement_read(ser_ref);
20341 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20342 return (uint64_t)ret_conv;
20345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20346 LDKUnsignedChannelUpdate obj_conv;
20347 obj_conv.inner = (void*)(obj & (~1));
20348 obj_conv.is_owned = false;
20349 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20350 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20351 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20352 CVec_u8Z_free(ret_var);
20356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20357 LDKu8slice ser_ref;
20358 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20359 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20360 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20361 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20362 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20363 return (uint64_t)ret_conv;
20366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20367 LDKChannelUpdate obj_conv;
20368 obj_conv.inner = (void*)(obj & (~1));
20369 obj_conv.is_owned = false;
20370 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20371 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20372 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20373 CVec_u8Z_free(ret_var);
20377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20378 LDKu8slice ser_ref;
20379 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20380 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20381 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20382 *ret_conv = ChannelUpdate_read(ser_ref);
20383 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20384 return (uint64_t)ret_conv;
20387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20388 LDKErrorMessage obj_conv;
20389 obj_conv.inner = (void*)(obj & (~1));
20390 obj_conv.is_owned = false;
20391 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20392 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20393 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20394 CVec_u8Z_free(ret_var);
20398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20399 LDKu8slice ser_ref;
20400 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20401 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20402 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20403 *ret_conv = ErrorMessage_read(ser_ref);
20404 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20405 return (uint64_t)ret_conv;
20408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20409 LDKUnsignedNodeAnnouncement obj_conv;
20410 obj_conv.inner = (void*)(obj & (~1));
20411 obj_conv.is_owned = false;
20412 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20413 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20414 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20415 CVec_u8Z_free(ret_var);
20419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20420 LDKu8slice ser_ref;
20421 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20422 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20423 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20424 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20425 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20426 return (uint64_t)ret_conv;
20429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20430 LDKNodeAnnouncement obj_conv;
20431 obj_conv.inner = (void*)(obj & (~1));
20432 obj_conv.is_owned = false;
20433 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20434 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20435 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20436 CVec_u8Z_free(ret_var);
20440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20441 LDKu8slice ser_ref;
20442 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20443 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20444 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20445 *ret_conv = NodeAnnouncement_read(ser_ref);
20446 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20447 return (uint64_t)ret_conv;
20450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20451 LDKu8slice ser_ref;
20452 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20453 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20454 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20455 *ret_conv = QueryShortChannelIds_read(ser_ref);
20456 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20457 return (uint64_t)ret_conv;
20460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20461 LDKQueryShortChannelIds obj_conv;
20462 obj_conv.inner = (void*)(obj & (~1));
20463 obj_conv.is_owned = false;
20464 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20465 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20466 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20467 CVec_u8Z_free(ret_var);
20471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20472 LDKu8slice ser_ref;
20473 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20474 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20475 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20476 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20477 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20478 return (uint64_t)ret_conv;
20481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20482 LDKReplyShortChannelIdsEnd obj_conv;
20483 obj_conv.inner = (void*)(obj & (~1));
20484 obj_conv.is_owned = false;
20485 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20486 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20487 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20488 CVec_u8Z_free(ret_var);
20492 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20493 LDKQueryChannelRange this_arg_conv;
20494 this_arg_conv.inner = (void*)(this_arg & (~1));
20495 this_arg_conv.is_owned = false;
20496 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20501 LDKu8slice ser_ref;
20502 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20503 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20504 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20505 *ret_conv = QueryChannelRange_read(ser_ref);
20506 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20507 return (uint64_t)ret_conv;
20510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20511 LDKQueryChannelRange obj_conv;
20512 obj_conv.inner = (void*)(obj & (~1));
20513 obj_conv.is_owned = false;
20514 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20515 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20516 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20517 CVec_u8Z_free(ret_var);
20521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20522 LDKu8slice ser_ref;
20523 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20524 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20525 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20526 *ret_conv = ReplyChannelRange_read(ser_ref);
20527 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20528 return (uint64_t)ret_conv;
20531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20532 LDKReplyChannelRange obj_conv;
20533 obj_conv.inner = (void*)(obj & (~1));
20534 obj_conv.is_owned = false;
20535 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20536 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20537 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20538 CVec_u8Z_free(ret_var);
20542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20543 LDKu8slice ser_ref;
20544 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20545 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20546 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20547 *ret_conv = GossipTimestampFilter_read(ser_ref);
20548 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20549 return (uint64_t)ret_conv;
20552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20553 LDKGossipTimestampFilter obj_conv;
20554 obj_conv.inner = (void*)(obj & (~1));
20555 obj_conv.is_owned = false;
20556 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20557 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20558 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20559 CVec_u8Z_free(ret_var);
20563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20564 LDKIgnoringMessageHandler this_obj_conv;
20565 this_obj_conv.inner = (void*)(this_obj & (~1));
20566 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20567 IgnoringMessageHandler_free(this_obj_conv);
20570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20571 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20574 uint64_t ret_ref = (uint64_t)ret_var.inner;
20575 if (ret_var.is_owned) {
20581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20582 LDKIgnoringMessageHandler this_arg_conv;
20583 this_arg_conv.inner = (void*)(this_arg & (~1));
20584 this_arg_conv.is_owned = false;
20585 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20586 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20587 return (uint64_t)ret;
20590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20591 LDKIgnoringMessageHandler this_arg_conv;
20592 this_arg_conv.inner = (void*)(this_arg & (~1));
20593 this_arg_conv.is_owned = false;
20594 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20595 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20596 return (uint64_t)ret;
20599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20600 LDKErroringMessageHandler this_obj_conv;
20601 this_obj_conv.inner = (void*)(this_obj & (~1));
20602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20603 ErroringMessageHandler_free(this_obj_conv);
20606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20607 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20610 uint64_t ret_ref = (uint64_t)ret_var.inner;
20611 if (ret_var.is_owned) {
20617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20618 LDKErroringMessageHandler this_arg_conv;
20619 this_arg_conv.inner = (void*)(this_arg & (~1));
20620 this_arg_conv.is_owned = false;
20621 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20622 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20623 return (uint64_t)ret;
20626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20627 LDKErroringMessageHandler this_arg_conv;
20628 this_arg_conv.inner = (void*)(this_arg & (~1));
20629 this_arg_conv.is_owned = false;
20630 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20631 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20632 return (uint64_t)ret;
20635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20636 LDKMessageHandler this_obj_conv;
20637 this_obj_conv.inner = (void*)(this_obj & (~1));
20638 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20639 MessageHandler_free(this_obj_conv);
20642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20643 LDKMessageHandler this_ptr_conv;
20644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20645 this_ptr_conv.is_owned = false;
20646 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20651 LDKMessageHandler this_ptr_conv;
20652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20653 this_ptr_conv.is_owned = false;
20654 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20655 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20656 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20657 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20659 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20663 LDKMessageHandler this_ptr_conv;
20664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20665 this_ptr_conv.is_owned = false;
20666 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20671 LDKMessageHandler this_ptr_conv;
20672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20673 this_ptr_conv.is_owned = false;
20674 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20675 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20676 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20677 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20679 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20682 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) {
20683 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20684 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20685 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20686 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20688 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20689 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20690 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20691 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20693 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20696 uint64_t ret_ref = (uint64_t)ret_var.inner;
20697 if (ret_var.is_owned) {
20703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20704 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20705 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20706 *ret = SocketDescriptor_clone(orig_conv);
20707 return (uint64_t)ret;
20710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20711 if ((this_ptr & 1) != 0) return;
20712 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20713 FREE((void*)this_ptr);
20714 SocketDescriptor_free(this_ptr_conv);
20717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20718 LDKPeerHandleError this_obj_conv;
20719 this_obj_conv.inner = (void*)(this_obj & (~1));
20720 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20721 PeerHandleError_free(this_obj_conv);
20724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
20725 LDKPeerHandleError this_ptr_conv;
20726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20727 this_ptr_conv.is_owned = false;
20728 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20733 LDKPeerHandleError this_ptr_conv;
20734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20735 this_ptr_conv.is_owned = false;
20736 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
20740 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20743 uint64_t ret_ref = (uint64_t)ret_var.inner;
20744 if (ret_var.is_owned) {
20750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20751 LDKPeerHandleError orig_conv;
20752 orig_conv.inner = (void*)(orig & (~1));
20753 orig_conv.is_owned = false;
20754 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_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 void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20765 LDKPeerManager this_obj_conv;
20766 this_obj_conv.inner = (void*)(this_obj & (~1));
20767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20768 PeerManager_free(this_obj_conv);
20771 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) {
20772 LDKMessageHandler message_handler_conv;
20773 message_handler_conv.inner = (void*)(message_handler & (~1));
20774 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20775 // Warning: we need a move here but no clone is available for LDKMessageHandler
20776 LDKSecretKey our_node_secret_ref;
20777 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
20778 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
20779 unsigned char ephemeral_random_data_arr[32];
20780 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
20781 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
20782 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20783 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20784 if (logger_conv.free == LDKLogger_JCalls_free) {
20785 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20786 LDKLogger_JCalls_clone(logger_conv.this_arg);
20788 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
20789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20791 uint64_t ret_ref = (uint64_t)ret_var.inner;
20792 if (ret_var.is_owned) {
20798 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
20799 LDKPeerManager this_arg_conv;
20800 this_arg_conv.inner = (void*)(this_arg & (~1));
20801 this_arg_conv.is_owned = false;
20802 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20803 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
20805 for (size_t i = 0; i < ret_var.datalen; i++) {
20806 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
20807 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
20808 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
20810 FREE(ret_var.data);
20814 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) {
20815 LDKPeerManager this_arg_conv;
20816 this_arg_conv.inner = (void*)(this_arg & (~1));
20817 this_arg_conv.is_owned = false;
20818 LDKPublicKey their_node_id_ref;
20819 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20820 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20821 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20822 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20823 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20824 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20826 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20827 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20828 return (uint64_t)ret_conv;
20831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20832 LDKPeerManager this_arg_conv;
20833 this_arg_conv.inner = (void*)(this_arg & (~1));
20834 this_arg_conv.is_owned = false;
20835 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20836 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20837 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20838 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20840 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20841 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20842 return (uint64_t)ret_conv;
20845 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) {
20846 LDKPeerManager this_arg_conv;
20847 this_arg_conv.inner = (void*)(this_arg & (~1));
20848 this_arg_conv.is_owned = false;
20849 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20850 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20851 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20852 return (uint64_t)ret_conv;
20855 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) {
20856 LDKPeerManager this_arg_conv;
20857 this_arg_conv.inner = (void*)(this_arg & (~1));
20858 this_arg_conv.is_owned = false;
20859 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20860 LDKu8slice data_ref;
20861 data_ref.datalen = (*env)->GetArrayLength(env, data);
20862 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
20863 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20864 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20865 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
20866 return (uint64_t)ret_conv;
20869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
20870 LDKPeerManager this_arg_conv;
20871 this_arg_conv.inner = (void*)(this_arg & (~1));
20872 this_arg_conv.is_owned = false;
20873 PeerManager_process_events(&this_arg_conv);
20876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20877 LDKPeerManager this_arg_conv;
20878 this_arg_conv.inner = (void*)(this_arg & (~1));
20879 this_arg_conv.is_owned = false;
20880 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20881 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20884 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) {
20885 LDKPeerManager this_arg_conv;
20886 this_arg_conv.inner = (void*)(this_arg & (~1));
20887 this_arg_conv.is_owned = false;
20888 LDKPublicKey node_id_ref;
20889 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20890 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20891 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20895 LDKPeerManager this_arg_conv;
20896 this_arg_conv.inner = (void*)(this_arg & (~1));
20897 this_arg_conv.is_owned = false;
20898 PeerManager_timer_tick_occurred(&this_arg_conv);
20901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
20902 unsigned char commitment_seed_arr[32];
20903 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
20904 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
20905 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
20906 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20907 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
20911 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) {
20912 LDKPublicKey per_commitment_point_ref;
20913 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20914 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20915 unsigned char base_secret_arr[32];
20916 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
20917 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
20918 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
20919 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20920 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
20921 return (uint64_t)ret_conv;
20924 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) {
20925 LDKPublicKey per_commitment_point_ref;
20926 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20927 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20928 LDKPublicKey base_point_ref;
20929 CHECK((*env)->GetArrayLength(env, base_point) == 33);
20930 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
20931 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20932 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
20933 return (uint64_t)ret_conv;
20936 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) {
20937 unsigned char per_commitment_secret_arr[32];
20938 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
20939 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
20940 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
20941 unsigned char countersignatory_revocation_base_secret_arr[32];
20942 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
20943 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
20944 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
20945 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20946 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
20947 return (uint64_t)ret_conv;
20950 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) {
20951 LDKPublicKey per_commitment_point_ref;
20952 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20953 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20954 LDKPublicKey countersignatory_revocation_base_point_ref;
20955 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
20956 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
20957 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20958 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
20959 return (uint64_t)ret_conv;
20962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20963 LDKTxCreationKeys this_obj_conv;
20964 this_obj_conv.inner = (void*)(this_obj & (~1));
20965 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20966 TxCreationKeys_free(this_obj_conv);
20969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20970 LDKTxCreationKeys this_ptr_conv;
20971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20972 this_ptr_conv.is_owned = false;
20973 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20974 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
20978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20979 LDKTxCreationKeys this_ptr_conv;
20980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20981 this_ptr_conv.is_owned = false;
20982 LDKPublicKey val_ref;
20983 CHECK((*env)->GetArrayLength(env, val) == 33);
20984 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20985 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
20988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20989 LDKTxCreationKeys this_ptr_conv;
20990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20991 this_ptr_conv.is_owned = false;
20992 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20993 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
20997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20998 LDKTxCreationKeys this_ptr_conv;
20999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21000 this_ptr_conv.is_owned = false;
21001 LDKPublicKey val_ref;
21002 CHECK((*env)->GetArrayLength(env, val) == 33);
21003 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21004 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21008 LDKTxCreationKeys this_ptr_conv;
21009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21010 this_ptr_conv.is_owned = false;
21011 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21012 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21017 LDKTxCreationKeys this_ptr_conv;
21018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21019 this_ptr_conv.is_owned = false;
21020 LDKPublicKey val_ref;
21021 CHECK((*env)->GetArrayLength(env, val) == 33);
21022 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21023 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21027 LDKTxCreationKeys this_ptr_conv;
21028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21029 this_ptr_conv.is_owned = false;
21030 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21031 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21036 LDKTxCreationKeys this_ptr_conv;
21037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21038 this_ptr_conv.is_owned = false;
21039 LDKPublicKey val_ref;
21040 CHECK((*env)->GetArrayLength(env, val) == 33);
21041 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21042 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21046 LDKTxCreationKeys this_ptr_conv;
21047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21048 this_ptr_conv.is_owned = false;
21049 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21050 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21054 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) {
21055 LDKTxCreationKeys this_ptr_conv;
21056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21057 this_ptr_conv.is_owned = false;
21058 LDKPublicKey val_ref;
21059 CHECK((*env)->GetArrayLength(env, val) == 33);
21060 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21061 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21064 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) {
21065 LDKPublicKey per_commitment_point_arg_ref;
21066 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21067 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21068 LDKPublicKey revocation_key_arg_ref;
21069 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21070 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21071 LDKPublicKey broadcaster_htlc_key_arg_ref;
21072 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21073 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21074 LDKPublicKey countersignatory_htlc_key_arg_ref;
21075 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21076 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21077 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21078 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21079 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21080 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);
21081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21083 uint64_t ret_ref = (uint64_t)ret_var.inner;
21084 if (ret_var.is_owned) {
21090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21091 LDKTxCreationKeys orig_conv;
21092 orig_conv.inner = (void*)(orig & (~1));
21093 orig_conv.is_owned = false;
21094 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21097 uint64_t ret_ref = (uint64_t)ret_var.inner;
21098 if (ret_var.is_owned) {
21104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21105 LDKTxCreationKeys obj_conv;
21106 obj_conv.inner = (void*)(obj & (~1));
21107 obj_conv.is_owned = false;
21108 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21109 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21110 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21111 CVec_u8Z_free(ret_var);
21115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21116 LDKu8slice ser_ref;
21117 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21118 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21119 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21120 *ret_conv = TxCreationKeys_read(ser_ref);
21121 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21122 return (uint64_t)ret_conv;
21125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21126 LDKChannelPublicKeys this_obj_conv;
21127 this_obj_conv.inner = (void*)(this_obj & (~1));
21128 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21129 ChannelPublicKeys_free(this_obj_conv);
21132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21133 LDKChannelPublicKeys this_ptr_conv;
21134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21135 this_ptr_conv.is_owned = false;
21136 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21137 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21142 LDKChannelPublicKeys this_ptr_conv;
21143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21144 this_ptr_conv.is_owned = false;
21145 LDKPublicKey val_ref;
21146 CHECK((*env)->GetArrayLength(env, val) == 33);
21147 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21148 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21152 LDKChannelPublicKeys this_ptr_conv;
21153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21154 this_ptr_conv.is_owned = false;
21155 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21161 LDKChannelPublicKeys this_ptr_conv;
21162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21163 this_ptr_conv.is_owned = false;
21164 LDKPublicKey val_ref;
21165 CHECK((*env)->GetArrayLength(env, val) == 33);
21166 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21167 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21171 LDKChannelPublicKeys this_ptr_conv;
21172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21173 this_ptr_conv.is_owned = false;
21174 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21180 LDKChannelPublicKeys this_ptr_conv;
21181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21182 this_ptr_conv.is_owned = false;
21183 LDKPublicKey val_ref;
21184 CHECK((*env)->GetArrayLength(env, val) == 33);
21185 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21186 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21190 LDKChannelPublicKeys this_ptr_conv;
21191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21192 this_ptr_conv.is_owned = false;
21193 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21199 LDKChannelPublicKeys this_ptr_conv;
21200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21201 this_ptr_conv.is_owned = false;
21202 LDKPublicKey val_ref;
21203 CHECK((*env)->GetArrayLength(env, val) == 33);
21204 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21205 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21209 LDKChannelPublicKeys this_ptr_conv;
21210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21211 this_ptr_conv.is_owned = false;
21212 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21213 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21218 LDKChannelPublicKeys this_ptr_conv;
21219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21220 this_ptr_conv.is_owned = false;
21221 LDKPublicKey val_ref;
21222 CHECK((*env)->GetArrayLength(env, val) == 33);
21223 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21224 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21227 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) {
21228 LDKPublicKey funding_pubkey_arg_ref;
21229 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21230 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21231 LDKPublicKey revocation_basepoint_arg_ref;
21232 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21233 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21234 LDKPublicKey payment_point_arg_ref;
21235 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21236 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21237 LDKPublicKey delayed_payment_basepoint_arg_ref;
21238 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21239 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21240 LDKPublicKey htlc_basepoint_arg_ref;
21241 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21242 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21243 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);
21244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21246 uint64_t ret_ref = (uint64_t)ret_var.inner;
21247 if (ret_var.is_owned) {
21253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21254 LDKChannelPublicKeys orig_conv;
21255 orig_conv.inner = (void*)(orig & (~1));
21256 orig_conv.is_owned = false;
21257 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21260 uint64_t ret_ref = (uint64_t)ret_var.inner;
21261 if (ret_var.is_owned) {
21267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21268 LDKChannelPublicKeys obj_conv;
21269 obj_conv.inner = (void*)(obj & (~1));
21270 obj_conv.is_owned = false;
21271 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21272 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21273 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21274 CVec_u8Z_free(ret_var);
21278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21279 LDKu8slice ser_ref;
21280 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21281 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21282 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21283 *ret_conv = ChannelPublicKeys_read(ser_ref);
21284 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21285 return (uint64_t)ret_conv;
21288 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) {
21289 LDKPublicKey per_commitment_point_ref;
21290 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21291 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21292 LDKPublicKey broadcaster_delayed_payment_base_ref;
21293 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21294 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21295 LDKPublicKey broadcaster_htlc_base_ref;
21296 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21297 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21298 LDKPublicKey countersignatory_revocation_base_ref;
21299 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21300 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21301 LDKPublicKey countersignatory_htlc_base_ref;
21302 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21303 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21304 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21305 *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);
21306 return (uint64_t)ret_conv;
21309 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) {
21310 LDKPublicKey per_commitment_point_ref;
21311 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21312 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21313 LDKChannelPublicKeys broadcaster_keys_conv;
21314 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21315 broadcaster_keys_conv.is_owned = false;
21316 LDKChannelPublicKeys countersignatory_keys_conv;
21317 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21318 countersignatory_keys_conv.is_owned = false;
21319 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21320 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21321 return (uint64_t)ret_conv;
21324 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) {
21325 LDKPublicKey revocation_key_ref;
21326 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21327 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21328 LDKPublicKey broadcaster_delayed_payment_key_ref;
21329 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21330 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21331 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21332 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21333 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21334 CVec_u8Z_free(ret_var);
21338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21339 LDKHTLCOutputInCommitment this_obj_conv;
21340 this_obj_conv.inner = (void*)(this_obj & (~1));
21341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21342 HTLCOutputInCommitment_free(this_obj_conv);
21345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21346 LDKHTLCOutputInCommitment this_ptr_conv;
21347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21348 this_ptr_conv.is_owned = false;
21349 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21354 LDKHTLCOutputInCommitment this_ptr_conv;
21355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21356 this_ptr_conv.is_owned = false;
21357 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21361 LDKHTLCOutputInCommitment this_ptr_conv;
21362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21363 this_ptr_conv.is_owned = false;
21364 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21369 LDKHTLCOutputInCommitment this_ptr_conv;
21370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21371 this_ptr_conv.is_owned = false;
21372 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21375 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21376 LDKHTLCOutputInCommitment this_ptr_conv;
21377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21378 this_ptr_conv.is_owned = false;
21379 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21384 LDKHTLCOutputInCommitment this_ptr_conv;
21385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21386 this_ptr_conv.is_owned = false;
21387 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21391 LDKHTLCOutputInCommitment this_ptr_conv;
21392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21393 this_ptr_conv.is_owned = false;
21394 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21395 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21400 LDKHTLCOutputInCommitment this_ptr_conv;
21401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21402 this_ptr_conv.is_owned = false;
21403 LDKThirtyTwoBytes val_ref;
21404 CHECK((*env)->GetArrayLength(env, val) == 32);
21405 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21406 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21410 LDKHTLCOutputInCommitment this_ptr_conv;
21411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21412 this_ptr_conv.is_owned = false;
21413 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21414 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21415 uint64_t ret_ref = (uint64_t)ret_copy;
21419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21420 LDKHTLCOutputInCommitment this_ptr_conv;
21421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21422 this_ptr_conv.is_owned = false;
21423 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21424 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21427 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) {
21428 LDKThirtyTwoBytes payment_hash_arg_ref;
21429 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21430 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21431 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21432 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21435 uint64_t ret_ref = (uint64_t)ret_var.inner;
21436 if (ret_var.is_owned) {
21442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21443 LDKHTLCOutputInCommitment orig_conv;
21444 orig_conv.inner = (void*)(orig & (~1));
21445 orig_conv.is_owned = false;
21446 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21449 uint64_t ret_ref = (uint64_t)ret_var.inner;
21450 if (ret_var.is_owned) {
21456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21457 LDKHTLCOutputInCommitment obj_conv;
21458 obj_conv.inner = (void*)(obj & (~1));
21459 obj_conv.is_owned = false;
21460 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21461 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21462 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21463 CVec_u8Z_free(ret_var);
21467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21468 LDKu8slice ser_ref;
21469 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21470 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21471 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21472 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21473 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21474 return (uint64_t)ret_conv;
21477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21478 LDKHTLCOutputInCommitment htlc_conv;
21479 htlc_conv.inner = (void*)(htlc & (~1));
21480 htlc_conv.is_owned = false;
21481 LDKTxCreationKeys keys_conv;
21482 keys_conv.inner = (void*)(keys & (~1));
21483 keys_conv.is_owned = false;
21484 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21485 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21486 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21487 CVec_u8Z_free(ret_var);
21491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21492 LDKPublicKey broadcaster_ref;
21493 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21494 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21495 LDKPublicKey countersignatory_ref;
21496 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21497 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21498 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21499 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21500 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21501 CVec_u8Z_free(ret_var);
21505 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) {
21506 unsigned char commitment_txid_arr[32];
21507 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21508 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21509 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21510 LDKHTLCOutputInCommitment htlc_conv;
21511 htlc_conv.inner = (void*)(htlc & (~1));
21512 htlc_conv.is_owned = false;
21513 LDKPublicKey broadcaster_delayed_payment_key_ref;
21514 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21515 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21516 LDKPublicKey revocation_key_ref;
21517 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21518 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21519 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21520 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21521 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21522 Transaction_free(ret_var);
21526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21527 LDKChannelTransactionParameters this_obj_conv;
21528 this_obj_conv.inner = (void*)(this_obj & (~1));
21529 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21530 ChannelTransactionParameters_free(this_obj_conv);
21533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21534 LDKChannelTransactionParameters this_ptr_conv;
21535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21536 this_ptr_conv.is_owned = false;
21537 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21540 uint64_t ret_ref = (uint64_t)ret_var.inner;
21541 if (ret_var.is_owned) {
21547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21548 LDKChannelTransactionParameters this_ptr_conv;
21549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21550 this_ptr_conv.is_owned = false;
21551 LDKChannelPublicKeys val_conv;
21552 val_conv.inner = (void*)(val & (~1));
21553 val_conv.is_owned = (val & 1) || (val == 0);
21554 val_conv = ChannelPublicKeys_clone(&val_conv);
21555 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21558 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21559 LDKChannelTransactionParameters this_ptr_conv;
21560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21561 this_ptr_conv.is_owned = false;
21562 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21566 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) {
21567 LDKChannelTransactionParameters this_ptr_conv;
21568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21569 this_ptr_conv.is_owned = false;
21570 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21574 LDKChannelTransactionParameters this_ptr_conv;
21575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21576 this_ptr_conv.is_owned = false;
21577 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21582 LDKChannelTransactionParameters this_ptr_conv;
21583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21584 this_ptr_conv.is_owned = false;
21585 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21589 LDKChannelTransactionParameters this_ptr_conv;
21590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21591 this_ptr_conv.is_owned = false;
21592 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21595 uint64_t ret_ref = (uint64_t)ret_var.inner;
21596 if (ret_var.is_owned) {
21602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21603 LDKChannelTransactionParameters this_ptr_conv;
21604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21605 this_ptr_conv.is_owned = false;
21606 LDKCounterpartyChannelTransactionParameters val_conv;
21607 val_conv.inner = (void*)(val & (~1));
21608 val_conv.is_owned = (val & 1) || (val == 0);
21609 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21610 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21614 LDKChannelTransactionParameters this_ptr_conv;
21615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21616 this_ptr_conv.is_owned = false;
21617 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21620 uint64_t ret_ref = (uint64_t)ret_var.inner;
21621 if (ret_var.is_owned) {
21627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21628 LDKChannelTransactionParameters this_ptr_conv;
21629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21630 this_ptr_conv.is_owned = false;
21631 LDKOutPoint val_conv;
21632 val_conv.inner = (void*)(val & (~1));
21633 val_conv.is_owned = (val & 1) || (val == 0);
21634 val_conv = OutPoint_clone(&val_conv);
21635 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21638 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) {
21639 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21640 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21641 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21642 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21643 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21644 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21645 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21646 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21647 LDKOutPoint funding_outpoint_arg_conv;
21648 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21649 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21650 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21651 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);
21652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21654 uint64_t ret_ref = (uint64_t)ret_var.inner;
21655 if (ret_var.is_owned) {
21661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21662 LDKChannelTransactionParameters orig_conv;
21663 orig_conv.inner = (void*)(orig & (~1));
21664 orig_conv.is_owned = false;
21665 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21668 uint64_t ret_ref = (uint64_t)ret_var.inner;
21669 if (ret_var.is_owned) {
21675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21676 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21677 this_obj_conv.inner = (void*)(this_obj & (~1));
21678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21679 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21683 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21685 this_ptr_conv.is_owned = false;
21686 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21689 uint64_t ret_ref = (uint64_t)ret_var.inner;
21690 if (ret_var.is_owned) {
21696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21697 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21699 this_ptr_conv.is_owned = false;
21700 LDKChannelPublicKeys val_conv;
21701 val_conv.inner = (void*)(val & (~1));
21702 val_conv.is_owned = (val & 1) || (val == 0);
21703 val_conv = ChannelPublicKeys_clone(&val_conv);
21704 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21707 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21708 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21710 this_ptr_conv.is_owned = false;
21711 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21716 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21718 this_ptr_conv.is_owned = false;
21719 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21722 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) {
21723 LDKChannelPublicKeys pubkeys_arg_conv;
21724 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21725 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21726 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21727 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21730 uint64_t ret_ref = (uint64_t)ret_var.inner;
21731 if (ret_var.is_owned) {
21737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21738 LDKCounterpartyChannelTransactionParameters orig_conv;
21739 orig_conv.inner = (void*)(orig & (~1));
21740 orig_conv.is_owned = false;
21741 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21744 uint64_t ret_ref = (uint64_t)ret_var.inner;
21745 if (ret_var.is_owned) {
21751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
21752 LDKChannelTransactionParameters this_arg_conv;
21753 this_arg_conv.inner = (void*)(this_arg & (~1));
21754 this_arg_conv.is_owned = false;
21755 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21760 LDKChannelTransactionParameters this_arg_conv;
21761 this_arg_conv.inner = (void*)(this_arg & (~1));
21762 this_arg_conv.is_owned = false;
21763 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21766 uint64_t ret_ref = (uint64_t)ret_var.inner;
21767 if (ret_var.is_owned) {
21773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21774 LDKChannelTransactionParameters this_arg_conv;
21775 this_arg_conv.inner = (void*)(this_arg & (~1));
21776 this_arg_conv.is_owned = false;
21777 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21780 uint64_t ret_ref = (uint64_t)ret_var.inner;
21781 if (ret_var.is_owned) {
21787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21788 LDKCounterpartyChannelTransactionParameters obj_conv;
21789 obj_conv.inner = (void*)(obj & (~1));
21790 obj_conv.is_owned = false;
21791 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21792 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21793 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21794 CVec_u8Z_free(ret_var);
21798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21799 LDKu8slice ser_ref;
21800 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21801 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21802 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21803 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21804 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21805 return (uint64_t)ret_conv;
21808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21809 LDKChannelTransactionParameters obj_conv;
21810 obj_conv.inner = (void*)(obj & (~1));
21811 obj_conv.is_owned = false;
21812 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21813 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21814 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21815 CVec_u8Z_free(ret_var);
21819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21820 LDKu8slice ser_ref;
21821 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21822 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21823 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21824 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21825 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21826 return (uint64_t)ret_conv;
21829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21830 LDKDirectedChannelTransactionParameters this_obj_conv;
21831 this_obj_conv.inner = (void*)(this_obj & (~1));
21832 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21833 DirectedChannelTransactionParameters_free(this_obj_conv);
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21837 LDKDirectedChannelTransactionParameters this_arg_conv;
21838 this_arg_conv.inner = (void*)(this_arg & (~1));
21839 this_arg_conv.is_owned = false;
21840 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21843 uint64_t ret_ref = (uint64_t)ret_var.inner;
21844 if (ret_var.is_owned) {
21850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21851 LDKDirectedChannelTransactionParameters this_arg_conv;
21852 this_arg_conv.inner = (void*)(this_arg & (~1));
21853 this_arg_conv.is_owned = false;
21854 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21857 uint64_t ret_ref = (uint64_t)ret_var.inner;
21858 if (ret_var.is_owned) {
21864 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
21865 LDKDirectedChannelTransactionParameters this_arg_conv;
21866 this_arg_conv.inner = (void*)(this_arg & (~1));
21867 this_arg_conv.is_owned = false;
21868 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
21873 LDKDirectedChannelTransactionParameters this_arg_conv;
21874 this_arg_conv.inner = (void*)(this_arg & (~1));
21875 this_arg_conv.is_owned = false;
21876 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
21880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
21881 LDKDirectedChannelTransactionParameters this_arg_conv;
21882 this_arg_conv.inner = (void*)(this_arg & (~1));
21883 this_arg_conv.is_owned = false;
21884 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
21885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21887 uint64_t ret_ref = (uint64_t)ret_var.inner;
21888 if (ret_var.is_owned) {
21894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21895 LDKHolderCommitmentTransaction this_obj_conv;
21896 this_obj_conv.inner = (void*)(this_obj & (~1));
21897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21898 HolderCommitmentTransaction_free(this_obj_conv);
21901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
21902 LDKHolderCommitmentTransaction this_ptr_conv;
21903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21904 this_ptr_conv.is_owned = false;
21905 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21906 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
21910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21911 LDKHolderCommitmentTransaction this_ptr_conv;
21912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21913 this_ptr_conv.is_owned = false;
21914 LDKSignature val_ref;
21915 CHECK((*env)->GetArrayLength(env, val) == 64);
21916 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21917 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
21920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21921 LDKHolderCommitmentTransaction this_ptr_conv;
21922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21923 this_ptr_conv.is_owned = false;
21924 LDKCVec_SignatureZ val_constr;
21925 val_constr.datalen = (*env)->GetArrayLength(env, val);
21926 if (val_constr.datalen > 0)
21927 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21929 val_constr.data = NULL;
21930 for (size_t i = 0; i < val_constr.datalen; i++) {
21931 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21932 LDKSignature val_conv_8_ref;
21933 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21934 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21935 val_constr.data[i] = val_conv_8_ref;
21937 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
21940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21941 LDKHolderCommitmentTransaction orig_conv;
21942 orig_conv.inner = (void*)(orig & (~1));
21943 orig_conv.is_owned = false;
21944 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
21945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21947 uint64_t ret_ref = (uint64_t)ret_var.inner;
21948 if (ret_var.is_owned) {
21954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
21955 LDKHolderCommitmentTransaction obj_conv;
21956 obj_conv.inner = (void*)(obj & (~1));
21957 obj_conv.is_owned = false;
21958 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
21959 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21960 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21961 CVec_u8Z_free(ret_var);
21965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21966 LDKu8slice ser_ref;
21967 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21968 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21969 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
21970 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
21971 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21972 return (uint64_t)ret_conv;
21975 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) {
21976 LDKCommitmentTransaction commitment_tx_conv;
21977 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
21978 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
21979 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
21980 LDKSignature counterparty_sig_ref;
21981 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
21982 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
21983 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
21984 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
21985 if (counterparty_htlc_sigs_constr.datalen > 0)
21986 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21988 counterparty_htlc_sigs_constr.data = NULL;
21989 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
21990 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
21991 LDKSignature counterparty_htlc_sigs_conv_8_ref;
21992 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
21993 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
21994 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
21996 LDKPublicKey holder_funding_key_ref;
21997 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
21998 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
21999 LDKPublicKey counterparty_funding_key_ref;
22000 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22001 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22002 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22005 uint64_t ret_ref = (uint64_t)ret_var.inner;
22006 if (ret_var.is_owned) {
22012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22013 LDKBuiltCommitmentTransaction this_obj_conv;
22014 this_obj_conv.inner = (void*)(this_obj & (~1));
22015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22016 BuiltCommitmentTransaction_free(this_obj_conv);
22019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22020 LDKBuiltCommitmentTransaction this_ptr_conv;
22021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22022 this_ptr_conv.is_owned = false;
22023 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22024 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22025 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22026 Transaction_free(ret_var);
22030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22031 LDKBuiltCommitmentTransaction this_ptr_conv;
22032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22033 this_ptr_conv.is_owned = false;
22034 LDKTransaction val_ref;
22035 val_ref.datalen = (*env)->GetArrayLength(env, val);
22036 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22037 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22038 val_ref.data_is_owned = true;
22039 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22043 LDKBuiltCommitmentTransaction this_ptr_conv;
22044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22045 this_ptr_conv.is_owned = false;
22046 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22052 LDKBuiltCommitmentTransaction this_ptr_conv;
22053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22054 this_ptr_conv.is_owned = false;
22055 LDKThirtyTwoBytes val_ref;
22056 CHECK((*env)->GetArrayLength(env, val) == 32);
22057 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22058 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22062 LDKTransaction transaction_arg_ref;
22063 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22064 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22065 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22066 transaction_arg_ref.data_is_owned = true;
22067 LDKThirtyTwoBytes txid_arg_ref;
22068 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22069 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22070 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22073 uint64_t ret_ref = (uint64_t)ret_var.inner;
22074 if (ret_var.is_owned) {
22080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22081 LDKBuiltCommitmentTransaction orig_conv;
22082 orig_conv.inner = (void*)(orig & (~1));
22083 orig_conv.is_owned = false;
22084 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22087 uint64_t ret_ref = (uint64_t)ret_var.inner;
22088 if (ret_var.is_owned) {
22094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22095 LDKBuiltCommitmentTransaction obj_conv;
22096 obj_conv.inner = (void*)(obj & (~1));
22097 obj_conv.is_owned = false;
22098 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22099 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22100 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22101 CVec_u8Z_free(ret_var);
22105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22106 LDKu8slice ser_ref;
22107 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22108 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22109 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22110 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22111 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22112 return (uint64_t)ret_conv;
22115 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) {
22116 LDKBuiltCommitmentTransaction this_arg_conv;
22117 this_arg_conv.inner = (void*)(this_arg & (~1));
22118 this_arg_conv.is_owned = false;
22119 LDKu8slice funding_redeemscript_ref;
22120 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22121 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22122 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22124 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22128 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) {
22129 LDKBuiltCommitmentTransaction this_arg_conv;
22130 this_arg_conv.inner = (void*)(this_arg & (~1));
22131 this_arg_conv.is_owned = false;
22132 unsigned char funding_key_arr[32];
22133 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22134 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22135 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22136 LDKu8slice funding_redeemscript_ref;
22137 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22138 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22139 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22141 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22146 LDKCommitmentTransaction this_obj_conv;
22147 this_obj_conv.inner = (void*)(this_obj & (~1));
22148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22149 CommitmentTransaction_free(this_obj_conv);
22152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22153 LDKCommitmentTransaction orig_conv;
22154 orig_conv.inner = (void*)(orig & (~1));
22155 orig_conv.is_owned = false;
22156 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22159 uint64_t ret_ref = (uint64_t)ret_var.inner;
22160 if (ret_var.is_owned) {
22166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22167 LDKCommitmentTransaction obj_conv;
22168 obj_conv.inner = (void*)(obj & (~1));
22169 obj_conv.is_owned = false;
22170 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22171 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22172 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22173 CVec_u8Z_free(ret_var);
22177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22178 LDKu8slice ser_ref;
22179 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22180 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22181 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22182 *ret_conv = CommitmentTransaction_read(ser_ref);
22183 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22184 return (uint64_t)ret_conv;
22187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22188 LDKCommitmentTransaction this_arg_conv;
22189 this_arg_conv.inner = (void*)(this_arg & (~1));
22190 this_arg_conv.is_owned = false;
22191 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22196 LDKCommitmentTransaction this_arg_conv;
22197 this_arg_conv.inner = (void*)(this_arg & (~1));
22198 this_arg_conv.is_owned = false;
22199 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22204 LDKCommitmentTransaction this_arg_conv;
22205 this_arg_conv.inner = (void*)(this_arg & (~1));
22206 this_arg_conv.is_owned = false;
22207 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22211 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22212 LDKCommitmentTransaction this_arg_conv;
22213 this_arg_conv.inner = (void*)(this_arg & (~1));
22214 this_arg_conv.is_owned = false;
22215 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22220 LDKCommitmentTransaction this_arg_conv;
22221 this_arg_conv.inner = (void*)(this_arg & (~1));
22222 this_arg_conv.is_owned = false;
22223 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22226 uint64_t ret_ref = (uint64_t)ret_var.inner;
22227 if (ret_var.is_owned) {
22233 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) {
22234 LDKCommitmentTransaction this_arg_conv;
22235 this_arg_conv.inner = (void*)(this_arg & (~1));
22236 this_arg_conv.is_owned = false;
22237 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22238 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22239 channel_parameters_conv.is_owned = false;
22240 LDKChannelPublicKeys broadcaster_keys_conv;
22241 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22242 broadcaster_keys_conv.is_owned = false;
22243 LDKChannelPublicKeys countersignatory_keys_conv;
22244 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22245 countersignatory_keys_conv.is_owned = false;
22246 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22247 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22248 return (uint64_t)ret_conv;
22251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22252 LDKTrustedCommitmentTransaction this_obj_conv;
22253 this_obj_conv.inner = (void*)(this_obj & (~1));
22254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22255 TrustedCommitmentTransaction_free(this_obj_conv);
22258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22259 LDKTrustedCommitmentTransaction this_arg_conv;
22260 this_arg_conv.inner = (void*)(this_arg & (~1));
22261 this_arg_conv.is_owned = false;
22262 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22268 LDKTrustedCommitmentTransaction this_arg_conv;
22269 this_arg_conv.inner = (void*)(this_arg & (~1));
22270 this_arg_conv.is_owned = false;
22271 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22274 uint64_t ret_ref = (uint64_t)ret_var.inner;
22275 if (ret_var.is_owned) {
22281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22282 LDKTrustedCommitmentTransaction this_arg_conv;
22283 this_arg_conv.inner = (void*)(this_arg & (~1));
22284 this_arg_conv.is_owned = false;
22285 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22288 uint64_t ret_ref = (uint64_t)ret_var.inner;
22289 if (ret_var.is_owned) {
22295 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) {
22296 LDKTrustedCommitmentTransaction this_arg_conv;
22297 this_arg_conv.inner = (void*)(this_arg & (~1));
22298 this_arg_conv.is_owned = false;
22299 unsigned char htlc_base_key_arr[32];
22300 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22301 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22302 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22303 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22304 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22305 channel_parameters_conv.is_owned = false;
22306 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22307 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22308 return (uint64_t)ret_conv;
22311 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) {
22312 LDKPublicKey broadcaster_payment_basepoint_ref;
22313 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22314 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22315 LDKPublicKey countersignatory_payment_basepoint_ref;
22316 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22317 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22318 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22323 LDKInitFeatures a_conv;
22324 a_conv.inner = (void*)(a & (~1));
22325 a_conv.is_owned = false;
22326 LDKInitFeatures b_conv;
22327 b_conv.inner = (void*)(b & (~1));
22328 b_conv.is_owned = false;
22329 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22334 LDKNodeFeatures a_conv;
22335 a_conv.inner = (void*)(a & (~1));
22336 a_conv.is_owned = false;
22337 LDKNodeFeatures b_conv;
22338 b_conv.inner = (void*)(b & (~1));
22339 b_conv.is_owned = false;
22340 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22345 LDKChannelFeatures a_conv;
22346 a_conv.inner = (void*)(a & (~1));
22347 a_conv.is_owned = false;
22348 LDKChannelFeatures b_conv;
22349 b_conv.inner = (void*)(b & (~1));
22350 b_conv.is_owned = false;
22351 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22356 LDKInvoiceFeatures a_conv;
22357 a_conv.inner = (void*)(a & (~1));
22358 a_conv.is_owned = false;
22359 LDKInvoiceFeatures b_conv;
22360 b_conv.inner = (void*)(b & (~1));
22361 b_conv.is_owned = false;
22362 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22367 LDKInitFeatures orig_conv;
22368 orig_conv.inner = (void*)(orig & (~1));
22369 orig_conv.is_owned = false;
22370 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22373 uint64_t ret_ref = (uint64_t)ret_var.inner;
22374 if (ret_var.is_owned) {
22380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22381 LDKNodeFeatures orig_conv;
22382 orig_conv.inner = (void*)(orig & (~1));
22383 orig_conv.is_owned = false;
22384 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22387 uint64_t ret_ref = (uint64_t)ret_var.inner;
22388 if (ret_var.is_owned) {
22394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22395 LDKChannelFeatures orig_conv;
22396 orig_conv.inner = (void*)(orig & (~1));
22397 orig_conv.is_owned = false;
22398 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22401 uint64_t ret_ref = (uint64_t)ret_var.inner;
22402 if (ret_var.is_owned) {
22408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22409 LDKInvoiceFeatures orig_conv;
22410 orig_conv.inner = (void*)(orig & (~1));
22411 orig_conv.is_owned = false;
22412 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22415 uint64_t ret_ref = (uint64_t)ret_var.inner;
22416 if (ret_var.is_owned) {
22422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22423 LDKInitFeatures this_obj_conv;
22424 this_obj_conv.inner = (void*)(this_obj & (~1));
22425 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22426 InitFeatures_free(this_obj_conv);
22429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22430 LDKNodeFeatures this_obj_conv;
22431 this_obj_conv.inner = (void*)(this_obj & (~1));
22432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22433 NodeFeatures_free(this_obj_conv);
22436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22437 LDKChannelFeatures this_obj_conv;
22438 this_obj_conv.inner = (void*)(this_obj & (~1));
22439 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22440 ChannelFeatures_free(this_obj_conv);
22443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22444 LDKInvoiceFeatures this_obj_conv;
22445 this_obj_conv.inner = (void*)(this_obj & (~1));
22446 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22447 InvoiceFeatures_free(this_obj_conv);
22450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22451 LDKInitFeatures ret_var = InitFeatures_empty();
22452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22454 uint64_t ret_ref = (uint64_t)ret_var.inner;
22455 if (ret_var.is_owned) {
22461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22462 LDKInitFeatures ret_var = InitFeatures_known();
22463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22465 uint64_t ret_ref = (uint64_t)ret_var.inner;
22466 if (ret_var.is_owned) {
22472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22473 LDKNodeFeatures ret_var = NodeFeatures_empty();
22474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22476 uint64_t ret_ref = (uint64_t)ret_var.inner;
22477 if (ret_var.is_owned) {
22483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22484 LDKNodeFeatures ret_var = NodeFeatures_known();
22485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22487 uint64_t ret_ref = (uint64_t)ret_var.inner;
22488 if (ret_var.is_owned) {
22494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22495 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22496 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22497 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22498 uint64_t ret_ref = (uint64_t)ret_var.inner;
22499 if (ret_var.is_owned) {
22505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22506 LDKChannelFeatures ret_var = ChannelFeatures_known();
22507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22509 uint64_t ret_ref = (uint64_t)ret_var.inner;
22510 if (ret_var.is_owned) {
22516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22517 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22520 uint64_t ret_ref = (uint64_t)ret_var.inner;
22521 if (ret_var.is_owned) {
22527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22528 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22531 uint64_t ret_ref = (uint64_t)ret_var.inner;
22532 if (ret_var.is_owned) {
22538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22539 LDKInitFeatures this_arg_conv;
22540 this_arg_conv.inner = (void*)(this_arg & (~1));
22541 this_arg_conv.is_owned = false;
22542 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22547 LDKNodeFeatures this_arg_conv;
22548 this_arg_conv.inner = (void*)(this_arg & (~1));
22549 this_arg_conv.is_owned = false;
22550 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22555 LDKInvoiceFeatures this_arg_conv;
22556 this_arg_conv.inner = (void*)(this_arg & (~1));
22557 this_arg_conv.is_owned = false;
22558 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22563 LDKInitFeatures obj_conv;
22564 obj_conv.inner = (void*)(obj & (~1));
22565 obj_conv.is_owned = false;
22566 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22567 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22568 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22569 CVec_u8Z_free(ret_var);
22573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22574 LDKNodeFeatures obj_conv;
22575 obj_conv.inner = (void*)(obj & (~1));
22576 obj_conv.is_owned = false;
22577 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22578 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22579 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22580 CVec_u8Z_free(ret_var);
22584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22585 LDKChannelFeatures obj_conv;
22586 obj_conv.inner = (void*)(obj & (~1));
22587 obj_conv.is_owned = false;
22588 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22591 CVec_u8Z_free(ret_var);
22595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22596 LDKInvoiceFeatures obj_conv;
22597 obj_conv.inner = (void*)(obj & (~1));
22598 obj_conv.is_owned = false;
22599 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22600 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22601 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22602 CVec_u8Z_free(ret_var);
22606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22607 LDKu8slice ser_ref;
22608 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22609 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22610 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22611 *ret_conv = InitFeatures_read(ser_ref);
22612 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22613 return (uint64_t)ret_conv;
22616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22617 LDKu8slice ser_ref;
22618 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22619 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22620 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22621 *ret_conv = NodeFeatures_read(ser_ref);
22622 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22623 return (uint64_t)ret_conv;
22626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22627 LDKu8slice ser_ref;
22628 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22629 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22630 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22631 *ret_conv = ChannelFeatures_read(ser_ref);
22632 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22633 return (uint64_t)ret_conv;
22636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22637 LDKu8slice ser_ref;
22638 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22639 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22640 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22641 *ret_conv = InvoiceFeatures_read(ser_ref);
22642 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22643 return (uint64_t)ret_conv;
22646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22647 LDKRouteHop this_obj_conv;
22648 this_obj_conv.inner = (void*)(this_obj & (~1));
22649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22650 RouteHop_free(this_obj_conv);
22653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22654 LDKRouteHop this_ptr_conv;
22655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22656 this_ptr_conv.is_owned = false;
22657 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22658 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22663 LDKRouteHop this_ptr_conv;
22664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22665 this_ptr_conv.is_owned = false;
22666 LDKPublicKey val_ref;
22667 CHECK((*env)->GetArrayLength(env, val) == 33);
22668 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22669 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22673 LDKRouteHop this_ptr_conv;
22674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22675 this_ptr_conv.is_owned = false;
22676 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
22677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22679 uint64_t ret_ref = (uint64_t)ret_var.inner;
22680 if (ret_var.is_owned) {
22686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22687 LDKRouteHop this_ptr_conv;
22688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22689 this_ptr_conv.is_owned = false;
22690 LDKNodeFeatures val_conv;
22691 val_conv.inner = (void*)(val & (~1));
22692 val_conv.is_owned = (val & 1) || (val == 0);
22693 val_conv = NodeFeatures_clone(&val_conv);
22694 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22698 LDKRouteHop this_ptr_conv;
22699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22700 this_ptr_conv.is_owned = false;
22701 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
22705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22706 LDKRouteHop this_ptr_conv;
22707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22708 this_ptr_conv.is_owned = false;
22709 RouteHop_set_short_channel_id(&this_ptr_conv, val);
22712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22713 LDKRouteHop this_ptr_conv;
22714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22715 this_ptr_conv.is_owned = false;
22716 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
22717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22719 uint64_t ret_ref = (uint64_t)ret_var.inner;
22720 if (ret_var.is_owned) {
22726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22727 LDKRouteHop this_ptr_conv;
22728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22729 this_ptr_conv.is_owned = false;
22730 LDKChannelFeatures val_conv;
22731 val_conv.inner = (void*)(val & (~1));
22732 val_conv.is_owned = (val & 1) || (val == 0);
22733 val_conv = ChannelFeatures_clone(&val_conv);
22734 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
22737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22738 LDKRouteHop this_ptr_conv;
22739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22740 this_ptr_conv.is_owned = false;
22741 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
22745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22746 LDKRouteHop this_ptr_conv;
22747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22748 this_ptr_conv.is_owned = false;
22749 RouteHop_set_fee_msat(&this_ptr_conv, val);
22752 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22753 LDKRouteHop this_ptr_conv;
22754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22755 this_ptr_conv.is_owned = false;
22756 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
22760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22761 LDKRouteHop this_ptr_conv;
22762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22763 this_ptr_conv.is_owned = false;
22764 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
22767 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) {
22768 LDKPublicKey pubkey_arg_ref;
22769 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
22770 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
22771 LDKNodeFeatures node_features_arg_conv;
22772 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
22773 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
22774 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
22775 LDKChannelFeatures channel_features_arg_conv;
22776 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
22777 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
22778 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
22779 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);
22780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22782 uint64_t ret_ref = (uint64_t)ret_var.inner;
22783 if (ret_var.is_owned) {
22789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22790 LDKRouteHop orig_conv;
22791 orig_conv.inner = (void*)(orig & (~1));
22792 orig_conv.is_owned = false;
22793 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
22794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22796 uint64_t ret_ref = (uint64_t)ret_var.inner;
22797 if (ret_var.is_owned) {
22803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
22804 LDKRouteHop obj_conv;
22805 obj_conv.inner = (void*)(obj & (~1));
22806 obj_conv.is_owned = false;
22807 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
22808 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22809 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22810 CVec_u8Z_free(ret_var);
22814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22815 LDKu8slice ser_ref;
22816 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22817 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22818 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22819 *ret_conv = RouteHop_read(ser_ref);
22820 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22821 return (uint64_t)ret_conv;
22824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22825 LDKRoute this_obj_conv;
22826 this_obj_conv.inner = (void*)(this_obj & (~1));
22827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22828 Route_free(this_obj_conv);
22831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22832 LDKRoute this_ptr_conv;
22833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22834 this_ptr_conv.is_owned = false;
22835 LDKCVec_CVec_RouteHopZZ val_constr;
22836 val_constr.datalen = (*env)->GetArrayLength(env, val);
22837 if (val_constr.datalen > 0)
22838 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22840 val_constr.data = NULL;
22841 for (size_t m = 0; m < val_constr.datalen; m++) {
22842 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
22843 LDKCVec_RouteHopZ val_conv_12_constr;
22844 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
22845 if (val_conv_12_constr.datalen > 0)
22846 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22848 val_conv_12_constr.data = NULL;
22849 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
22850 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
22851 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
22852 LDKRouteHop val_conv_12_conv_10_conv;
22853 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
22854 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
22855 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
22856 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
22858 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
22859 val_constr.data[m] = val_conv_12_constr;
22861 Route_set_paths(&this_ptr_conv, val_constr);
22864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
22865 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
22866 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
22867 if (paths_arg_constr.datalen > 0)
22868 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22870 paths_arg_constr.data = NULL;
22871 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
22872 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
22873 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
22874 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
22875 if (paths_arg_conv_12_constr.datalen > 0)
22876 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22878 paths_arg_conv_12_constr.data = NULL;
22879 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
22880 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
22881 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
22882 LDKRouteHop paths_arg_conv_12_conv_10_conv;
22883 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
22884 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
22885 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
22886 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
22888 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
22889 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
22891 LDKRoute ret_var = Route_new(paths_arg_constr);
22892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22894 uint64_t ret_ref = (uint64_t)ret_var.inner;
22895 if (ret_var.is_owned) {
22901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22902 LDKRoute orig_conv;
22903 orig_conv.inner = (void*)(orig & (~1));
22904 orig_conv.is_owned = false;
22905 LDKRoute ret_var = Route_clone(&orig_conv);
22906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22908 uint64_t ret_ref = (uint64_t)ret_var.inner;
22909 if (ret_var.is_owned) {
22915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
22917 obj_conv.inner = (void*)(obj & (~1));
22918 obj_conv.is_owned = false;
22919 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
22920 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22921 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22922 CVec_u8Z_free(ret_var);
22926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22927 LDKu8slice ser_ref;
22928 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22929 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22930 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22931 *ret_conv = Route_read(ser_ref);
22932 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22933 return (uint64_t)ret_conv;
22936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22937 LDKRouteHint this_obj_conv;
22938 this_obj_conv.inner = (void*)(this_obj & (~1));
22939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22940 RouteHint_free(this_obj_conv);
22943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22944 LDKRouteHint a_conv;
22945 a_conv.inner = (void*)(a & (~1));
22946 a_conv.is_owned = false;
22947 LDKRouteHint b_conv;
22948 b_conv.inner = (void*)(b & (~1));
22949 b_conv.is_owned = false;
22950 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
22954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22955 LDKRouteHint orig_conv;
22956 orig_conv.inner = (void*)(orig & (~1));
22957 orig_conv.is_owned = false;
22958 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
22959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22961 uint64_t ret_ref = (uint64_t)ret_var.inner;
22962 if (ret_var.is_owned) {
22968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22969 LDKRouteHintHop this_obj_conv;
22970 this_obj_conv.inner = (void*)(this_obj & (~1));
22971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22972 RouteHintHop_free(this_obj_conv);
22975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22976 LDKRouteHintHop this_ptr_conv;
22977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22978 this_ptr_conv.is_owned = false;
22979 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22980 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
22984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22985 LDKRouteHintHop this_ptr_conv;
22986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22987 this_ptr_conv.is_owned = false;
22988 LDKPublicKey val_ref;
22989 CHECK((*env)->GetArrayLength(env, val) == 33);
22990 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22991 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
22994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22995 LDKRouteHintHop this_ptr_conv;
22996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22997 this_ptr_conv.is_owned = false;
22998 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23003 LDKRouteHintHop this_ptr_conv;
23004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23005 this_ptr_conv.is_owned = false;
23006 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23010 LDKRouteHintHop this_ptr_conv;
23011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23012 this_ptr_conv.is_owned = false;
23013 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23016 uint64_t ret_ref = (uint64_t)ret_var.inner;
23017 if (ret_var.is_owned) {
23023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23024 LDKRouteHintHop this_ptr_conv;
23025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23026 this_ptr_conv.is_owned = false;
23027 LDKRoutingFees val_conv;
23028 val_conv.inner = (void*)(val & (~1));
23029 val_conv.is_owned = (val & 1) || (val == 0);
23030 val_conv = RoutingFees_clone(&val_conv);
23031 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23034 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23035 LDKRouteHintHop this_ptr_conv;
23036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23037 this_ptr_conv.is_owned = false;
23038 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23043 LDKRouteHintHop this_ptr_conv;
23044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23045 this_ptr_conv.is_owned = false;
23046 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23050 LDKRouteHintHop this_ptr_conv;
23051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23052 this_ptr_conv.is_owned = false;
23053 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23054 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23055 uint64_t ret_ref = (uint64_t)ret_copy;
23059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23060 LDKRouteHintHop this_ptr_conv;
23061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23062 this_ptr_conv.is_owned = false;
23063 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23064 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23068 LDKRouteHintHop this_ptr_conv;
23069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23070 this_ptr_conv.is_owned = false;
23071 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23072 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23073 uint64_t ret_ref = (uint64_t)ret_copy;
23077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23078 LDKRouteHintHop this_ptr_conv;
23079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23080 this_ptr_conv.is_owned = false;
23081 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23082 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23085 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) {
23086 LDKPublicKey src_node_id_arg_ref;
23087 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23088 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23089 LDKRoutingFees fees_arg_conv;
23090 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23091 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23092 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23093 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23094 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23095 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);
23096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23098 uint64_t ret_ref = (uint64_t)ret_var.inner;
23099 if (ret_var.is_owned) {
23105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23106 LDKRouteHintHop a_conv;
23107 a_conv.inner = (void*)(a & (~1));
23108 a_conv.is_owned = false;
23109 LDKRouteHintHop b_conv;
23110 b_conv.inner = (void*)(b & (~1));
23111 b_conv.is_owned = false;
23112 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23117 LDKRouteHintHop orig_conv;
23118 orig_conv.inner = (void*)(orig & (~1));
23119 orig_conv.is_owned = false;
23120 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23123 uint64_t ret_ref = (uint64_t)ret_var.inner;
23124 if (ret_var.is_owned) {
23130 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) {
23131 LDKPublicKey our_node_id_ref;
23132 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23133 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23134 LDKNetworkGraph network_conv;
23135 network_conv.inner = (void*)(network & (~1));
23136 network_conv.is_owned = false;
23137 LDKPublicKey payee_ref;
23138 CHECK((*env)->GetArrayLength(env, payee) == 33);
23139 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23140 LDKInvoiceFeatures payee_features_conv;
23141 payee_features_conv.inner = (void*)(payee_features & (~1));
23142 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23143 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23144 LDKCVec_ChannelDetailsZ first_hops_constr;
23145 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23146 if (first_hops_constr.datalen > 0)
23147 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23149 first_hops_constr.data = NULL;
23150 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23151 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23152 int64_t first_hops_conv_16 = first_hops_vals[q];
23153 LDKChannelDetails first_hops_conv_16_conv;
23154 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23155 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23156 first_hops_constr.data[q] = first_hops_conv_16_conv;
23158 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23159 LDKCVec_RouteHintZ last_hops_constr;
23160 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23161 if (last_hops_constr.datalen > 0)
23162 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23164 last_hops_constr.data = NULL;
23165 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23166 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23167 int64_t last_hops_conv_11 = last_hops_vals[l];
23168 LDKRouteHint last_hops_conv_11_conv;
23169 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23170 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23171 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23172 last_hops_constr.data[l] = last_hops_conv_11_conv;
23174 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23175 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23176 if (logger_conv.free == LDKLogger_JCalls_free) {
23177 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23178 LDKLogger_JCalls_clone(logger_conv.this_arg);
23180 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23181 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23182 FREE(first_hops_constr.data);
23183 return (uint64_t)ret_conv;
23186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23187 LDKNetworkGraph this_obj_conv;
23188 this_obj_conv.inner = (void*)(this_obj & (~1));
23189 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23190 NetworkGraph_free(this_obj_conv);
23193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23194 LDKNetworkGraph orig_conv;
23195 orig_conv.inner = (void*)(orig & (~1));
23196 orig_conv.is_owned = false;
23197 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23200 uint64_t ret_ref = (uint64_t)ret_var.inner;
23201 if (ret_var.is_owned) {
23207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23208 LDKLockedNetworkGraph this_obj_conv;
23209 this_obj_conv.inner = (void*)(this_obj & (~1));
23210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23211 LockedNetworkGraph_free(this_obj_conv);
23214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23215 LDKNetGraphMsgHandler this_obj_conv;
23216 this_obj_conv.inner = (void*)(this_obj & (~1));
23217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23218 NetGraphMsgHandler_free(this_obj_conv);
23221 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) {
23222 LDKThirtyTwoBytes genesis_hash_ref;
23223 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23224 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23225 LDKAccess *chain_access_conv_ptr = NULL;
23226 if (chain_access != 0) {
23227 LDKAccess chain_access_conv;
23228 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23229 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23231 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23233 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23234 *chain_access_conv_ptr = chain_access_conv;
23236 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23237 if (logger_conv.free == LDKLogger_JCalls_free) {
23238 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23239 LDKLogger_JCalls_clone(logger_conv.this_arg);
23241 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23242 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23243 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23244 uint64_t ret_ref = (uint64_t)ret_var.inner;
23245 if (ret_var.is_owned) {
23251 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) {
23252 LDKAccess *chain_access_conv_ptr = NULL;
23253 if (chain_access != 0) {
23254 LDKAccess chain_access_conv;
23255 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23256 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23257 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23258 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23260 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23261 *chain_access_conv_ptr = chain_access_conv;
23263 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23264 if (logger_conv.free == LDKLogger_JCalls_free) {
23265 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23266 LDKLogger_JCalls_clone(logger_conv.this_arg);
23268 LDKNetworkGraph network_graph_conv;
23269 network_graph_conv.inner = (void*)(network_graph & (~1));
23270 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23271 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23272 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23275 uint64_t ret_ref = (uint64_t)ret_var.inner;
23276 if (ret_var.is_owned) {
23282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23283 LDKNetGraphMsgHandler this_arg_conv;
23284 this_arg_conv.inner = (void*)(this_arg & (~1));
23285 this_arg_conv.is_owned = false;
23286 LDKAccess *chain_access_conv_ptr = NULL;
23287 if (chain_access != 0) {
23288 LDKAccess chain_access_conv;
23289 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23290 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23291 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23292 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23294 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23295 *chain_access_conv_ptr = chain_access_conv;
23297 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23301 LDKNetGraphMsgHandler this_arg_conv;
23302 this_arg_conv.inner = (void*)(this_arg & (~1));
23303 this_arg_conv.is_owned = false;
23304 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23307 uint64_t ret_ref = (uint64_t)ret_var.inner;
23308 if (ret_var.is_owned) {
23314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23315 LDKLockedNetworkGraph this_arg_conv;
23316 this_arg_conv.inner = (void*)(this_arg & (~1));
23317 this_arg_conv.is_owned = false;
23318 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23321 uint64_t ret_ref = (uint64_t)ret_var.inner;
23322 if (ret_var.is_owned) {
23328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23329 LDKNetGraphMsgHandler this_arg_conv;
23330 this_arg_conv.inner = (void*)(this_arg & (~1));
23331 this_arg_conv.is_owned = false;
23332 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23333 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23334 return (uint64_t)ret;
23337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23338 LDKNetGraphMsgHandler this_arg_conv;
23339 this_arg_conv.inner = (void*)(this_arg & (~1));
23340 this_arg_conv.is_owned = false;
23341 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23342 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23343 return (uint64_t)ret;
23346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23347 LDKDirectionalChannelInfo this_obj_conv;
23348 this_obj_conv.inner = (void*)(this_obj & (~1));
23349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23350 DirectionalChannelInfo_free(this_obj_conv);
23353 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23354 LDKDirectionalChannelInfo this_ptr_conv;
23355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23356 this_ptr_conv.is_owned = false;
23357 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23362 LDKDirectionalChannelInfo this_ptr_conv;
23363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23364 this_ptr_conv.is_owned = false;
23365 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23369 LDKDirectionalChannelInfo this_ptr_conv;
23370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23371 this_ptr_conv.is_owned = false;
23372 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23377 LDKDirectionalChannelInfo this_ptr_conv;
23378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23379 this_ptr_conv.is_owned = false;
23380 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23383 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23384 LDKDirectionalChannelInfo this_ptr_conv;
23385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23386 this_ptr_conv.is_owned = false;
23387 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23392 LDKDirectionalChannelInfo this_ptr_conv;
23393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23394 this_ptr_conv.is_owned = false;
23395 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23399 LDKDirectionalChannelInfo this_ptr_conv;
23400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23401 this_ptr_conv.is_owned = false;
23402 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23407 LDKDirectionalChannelInfo this_ptr_conv;
23408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23409 this_ptr_conv.is_owned = false;
23410 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23414 LDKDirectionalChannelInfo this_ptr_conv;
23415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23416 this_ptr_conv.is_owned = false;
23417 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23418 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23419 uint64_t ret_ref = (uint64_t)ret_copy;
23423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23424 LDKDirectionalChannelInfo this_ptr_conv;
23425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23426 this_ptr_conv.is_owned = false;
23427 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23428 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23432 LDKDirectionalChannelInfo this_ptr_conv;
23433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23434 this_ptr_conv.is_owned = false;
23435 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23438 uint64_t ret_ref = (uint64_t)ret_var.inner;
23439 if (ret_var.is_owned) {
23445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23446 LDKDirectionalChannelInfo this_ptr_conv;
23447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23448 this_ptr_conv.is_owned = false;
23449 LDKRoutingFees val_conv;
23450 val_conv.inner = (void*)(val & (~1));
23451 val_conv.is_owned = (val & 1) || (val == 0);
23452 val_conv = RoutingFees_clone(&val_conv);
23453 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23457 LDKDirectionalChannelInfo this_ptr_conv;
23458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23459 this_ptr_conv.is_owned = false;
23460 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23463 uint64_t ret_ref = (uint64_t)ret_var.inner;
23464 if (ret_var.is_owned) {
23470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23471 LDKDirectionalChannelInfo this_ptr_conv;
23472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23473 this_ptr_conv.is_owned = false;
23474 LDKChannelUpdate val_conv;
23475 val_conv.inner = (void*)(val & (~1));
23476 val_conv.is_owned = (val & 1) || (val == 0);
23477 val_conv = ChannelUpdate_clone(&val_conv);
23478 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23481 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) {
23482 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23483 LDKRoutingFees fees_arg_conv;
23484 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23485 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23486 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23487 LDKChannelUpdate last_update_message_arg_conv;
23488 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23489 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23490 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23491 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);
23492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23494 uint64_t ret_ref = (uint64_t)ret_var.inner;
23495 if (ret_var.is_owned) {
23501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23502 LDKDirectionalChannelInfo orig_conv;
23503 orig_conv.inner = (void*)(orig & (~1));
23504 orig_conv.is_owned = false;
23505 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23508 uint64_t ret_ref = (uint64_t)ret_var.inner;
23509 if (ret_var.is_owned) {
23515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23516 LDKDirectionalChannelInfo obj_conv;
23517 obj_conv.inner = (void*)(obj & (~1));
23518 obj_conv.is_owned = false;
23519 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23520 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23521 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23522 CVec_u8Z_free(ret_var);
23526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23527 LDKu8slice ser_ref;
23528 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23529 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23530 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23531 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23532 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23533 return (uint64_t)ret_conv;
23536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23537 LDKChannelInfo this_obj_conv;
23538 this_obj_conv.inner = (void*)(this_obj & (~1));
23539 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23540 ChannelInfo_free(this_obj_conv);
23543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23544 LDKChannelInfo this_ptr_conv;
23545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23546 this_ptr_conv.is_owned = false;
23547 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23550 uint64_t ret_ref = (uint64_t)ret_var.inner;
23551 if (ret_var.is_owned) {
23557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23558 LDKChannelInfo this_ptr_conv;
23559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23560 this_ptr_conv.is_owned = false;
23561 LDKChannelFeatures val_conv;
23562 val_conv.inner = (void*)(val & (~1));
23563 val_conv.is_owned = (val & 1) || (val == 0);
23564 val_conv = ChannelFeatures_clone(&val_conv);
23565 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23569 LDKChannelInfo this_ptr_conv;
23570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23571 this_ptr_conv.is_owned = false;
23572 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23573 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23578 LDKChannelInfo this_ptr_conv;
23579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23580 this_ptr_conv.is_owned = false;
23581 LDKPublicKey val_ref;
23582 CHECK((*env)->GetArrayLength(env, val) == 33);
23583 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23584 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23588 LDKChannelInfo this_ptr_conv;
23589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23590 this_ptr_conv.is_owned = false;
23591 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23594 uint64_t ret_ref = (uint64_t)ret_var.inner;
23595 if (ret_var.is_owned) {
23601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23602 LDKChannelInfo this_ptr_conv;
23603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23604 this_ptr_conv.is_owned = false;
23605 LDKDirectionalChannelInfo val_conv;
23606 val_conv.inner = (void*)(val & (~1));
23607 val_conv.is_owned = (val & 1) || (val == 0);
23608 val_conv = DirectionalChannelInfo_clone(&val_conv);
23609 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23613 LDKChannelInfo this_ptr_conv;
23614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23615 this_ptr_conv.is_owned = false;
23616 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23617 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23622 LDKChannelInfo this_ptr_conv;
23623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23624 this_ptr_conv.is_owned = false;
23625 LDKPublicKey val_ref;
23626 CHECK((*env)->GetArrayLength(env, val) == 33);
23627 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23628 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23632 LDKChannelInfo this_ptr_conv;
23633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23634 this_ptr_conv.is_owned = false;
23635 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
23636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23638 uint64_t ret_ref = (uint64_t)ret_var.inner;
23639 if (ret_var.is_owned) {
23645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23646 LDKChannelInfo this_ptr_conv;
23647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23648 this_ptr_conv.is_owned = false;
23649 LDKDirectionalChannelInfo val_conv;
23650 val_conv.inner = (void*)(val & (~1));
23651 val_conv.is_owned = (val & 1) || (val == 0);
23652 val_conv = DirectionalChannelInfo_clone(&val_conv);
23653 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23657 LDKChannelInfo this_ptr_conv;
23658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23659 this_ptr_conv.is_owned = false;
23660 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23661 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23662 uint64_t ret_ref = (uint64_t)ret_copy;
23666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23667 LDKChannelInfo this_ptr_conv;
23668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23669 this_ptr_conv.is_owned = false;
23670 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23671 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23675 LDKChannelInfo this_ptr_conv;
23676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23677 this_ptr_conv.is_owned = false;
23678 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23681 uint64_t ret_ref = (uint64_t)ret_var.inner;
23682 if (ret_var.is_owned) {
23688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23689 LDKChannelInfo this_ptr_conv;
23690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23691 this_ptr_conv.is_owned = false;
23692 LDKChannelAnnouncement val_conv;
23693 val_conv.inner = (void*)(val & (~1));
23694 val_conv.is_owned = (val & 1) || (val == 0);
23695 val_conv = ChannelAnnouncement_clone(&val_conv);
23696 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
23699 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) {
23700 LDKChannelFeatures features_arg_conv;
23701 features_arg_conv.inner = (void*)(features_arg & (~1));
23702 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23703 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
23704 LDKPublicKey node_one_arg_ref;
23705 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
23706 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
23707 LDKDirectionalChannelInfo one_to_two_arg_conv;
23708 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
23709 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
23710 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
23711 LDKPublicKey node_two_arg_ref;
23712 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
23713 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
23714 LDKDirectionalChannelInfo two_to_one_arg_conv;
23715 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
23716 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
23717 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
23718 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
23719 LDKChannelAnnouncement announcement_message_arg_conv;
23720 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23721 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23722 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
23723 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);
23724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23726 uint64_t ret_ref = (uint64_t)ret_var.inner;
23727 if (ret_var.is_owned) {
23733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23734 LDKChannelInfo orig_conv;
23735 orig_conv.inner = (void*)(orig & (~1));
23736 orig_conv.is_owned = false;
23737 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
23738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23740 uint64_t ret_ref = (uint64_t)ret_var.inner;
23741 if (ret_var.is_owned) {
23747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23748 LDKChannelInfo obj_conv;
23749 obj_conv.inner = (void*)(obj & (~1));
23750 obj_conv.is_owned = false;
23751 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
23752 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23753 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23754 CVec_u8Z_free(ret_var);
23758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23759 LDKu8slice ser_ref;
23760 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23761 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23762 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23763 *ret_conv = ChannelInfo_read(ser_ref);
23764 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23765 return (uint64_t)ret_conv;
23768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23769 LDKRoutingFees this_obj_conv;
23770 this_obj_conv.inner = (void*)(this_obj & (~1));
23771 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23772 RoutingFees_free(this_obj_conv);
23775 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23776 LDKRoutingFees this_ptr_conv;
23777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23778 this_ptr_conv.is_owned = false;
23779 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
23783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23784 LDKRoutingFees this_ptr_conv;
23785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23786 this_ptr_conv.is_owned = false;
23787 RoutingFees_set_base_msat(&this_ptr_conv, val);
23790 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
23791 LDKRoutingFees this_ptr_conv;
23792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23793 this_ptr_conv.is_owned = false;
23794 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
23798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23799 LDKRoutingFees this_ptr_conv;
23800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23801 this_ptr_conv.is_owned = false;
23802 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
23805 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) {
23806 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
23807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23809 uint64_t ret_ref = (uint64_t)ret_var.inner;
23810 if (ret_var.is_owned) {
23816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23817 LDKRoutingFees a_conv;
23818 a_conv.inner = (void*)(a & (~1));
23819 a_conv.is_owned = false;
23820 LDKRoutingFees b_conv;
23821 b_conv.inner = (void*)(b & (~1));
23822 b_conv.is_owned = false;
23823 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
23827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23828 LDKRoutingFees orig_conv;
23829 orig_conv.inner = (void*)(orig & (~1));
23830 orig_conv.is_owned = false;
23831 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
23832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23834 uint64_t ret_ref = (uint64_t)ret_var.inner;
23835 if (ret_var.is_owned) {
23841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
23842 LDKRoutingFees obj_conv;
23843 obj_conv.inner = (void*)(obj & (~1));
23844 obj_conv.is_owned = false;
23845 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
23846 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23847 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23848 CVec_u8Z_free(ret_var);
23852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23853 LDKu8slice ser_ref;
23854 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23855 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23856 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23857 *ret_conv = RoutingFees_read(ser_ref);
23858 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23859 return (uint64_t)ret_conv;
23862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23863 LDKNodeAnnouncementInfo this_obj_conv;
23864 this_obj_conv.inner = (void*)(this_obj & (~1));
23865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23866 NodeAnnouncementInfo_free(this_obj_conv);
23869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23870 LDKNodeAnnouncementInfo this_ptr_conv;
23871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23872 this_ptr_conv.is_owned = false;
23873 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
23874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23876 uint64_t ret_ref = (uint64_t)ret_var.inner;
23877 if (ret_var.is_owned) {
23883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23884 LDKNodeAnnouncementInfo this_ptr_conv;
23885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23886 this_ptr_conv.is_owned = false;
23887 LDKNodeFeatures val_conv;
23888 val_conv.inner = (void*)(val & (~1));
23889 val_conv.is_owned = (val & 1) || (val == 0);
23890 val_conv = NodeFeatures_clone(&val_conv);
23891 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
23894 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23895 LDKNodeAnnouncementInfo this_ptr_conv;
23896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23897 this_ptr_conv.is_owned = false;
23898 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
23902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23903 LDKNodeAnnouncementInfo this_ptr_conv;
23904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23905 this_ptr_conv.is_owned = false;
23906 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
23909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
23910 LDKNodeAnnouncementInfo this_ptr_conv;
23911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23912 this_ptr_conv.is_owned = false;
23913 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
23914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
23918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23919 LDKNodeAnnouncementInfo this_ptr_conv;
23920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23921 this_ptr_conv.is_owned = false;
23922 LDKThreeBytes val_ref;
23923 CHECK((*env)->GetArrayLength(env, val) == 3);
23924 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
23925 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
23928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
23929 LDKNodeAnnouncementInfo this_ptr_conv;
23930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23931 this_ptr_conv.is_owned = false;
23932 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
23937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23938 LDKNodeAnnouncementInfo this_ptr_conv;
23939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23940 this_ptr_conv.is_owned = false;
23941 LDKThirtyTwoBytes val_ref;
23942 CHECK((*env)->GetArrayLength(env, val) == 32);
23943 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23944 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
23947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23948 LDKNodeAnnouncementInfo this_ptr_conv;
23949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23950 this_ptr_conv.is_owned = false;
23951 LDKCVec_NetAddressZ val_constr;
23952 val_constr.datalen = (*env)->GetArrayLength(env, val);
23953 if (val_constr.datalen > 0)
23954 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23956 val_constr.data = NULL;
23957 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23958 for (size_t m = 0; m < val_constr.datalen; m++) {
23959 int64_t val_conv_12 = val_vals[m];
23960 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
23961 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23962 val_constr.data[m] = val_conv_12_conv;
23964 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23965 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
23968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23969 LDKNodeAnnouncementInfo this_ptr_conv;
23970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23971 this_ptr_conv.is_owned = false;
23972 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
23973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23975 uint64_t ret_ref = (uint64_t)ret_var.inner;
23976 if (ret_var.is_owned) {
23982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23983 LDKNodeAnnouncementInfo this_ptr_conv;
23984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23985 this_ptr_conv.is_owned = false;
23986 LDKNodeAnnouncement val_conv;
23987 val_conv.inner = (void*)(val & (~1));
23988 val_conv.is_owned = (val & 1) || (val == 0);
23989 val_conv = NodeAnnouncement_clone(&val_conv);
23990 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
23993 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) {
23994 LDKNodeFeatures features_arg_conv;
23995 features_arg_conv.inner = (void*)(features_arg & (~1));
23996 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23997 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
23998 LDKThreeBytes rgb_arg_ref;
23999 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
24000 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24001 LDKThirtyTwoBytes alias_arg_ref;
24002 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24003 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24004 LDKCVec_NetAddressZ addresses_arg_constr;
24005 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24006 if (addresses_arg_constr.datalen > 0)
24007 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24009 addresses_arg_constr.data = NULL;
24010 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24011 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24012 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24013 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24014 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24016 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24017 LDKNodeAnnouncement announcement_message_arg_conv;
24018 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24019 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24020 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24021 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24024 uint64_t ret_ref = (uint64_t)ret_var.inner;
24025 if (ret_var.is_owned) {
24031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24032 LDKNodeAnnouncementInfo orig_conv;
24033 orig_conv.inner = (void*)(orig & (~1));
24034 orig_conv.is_owned = false;
24035 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24038 uint64_t ret_ref = (uint64_t)ret_var.inner;
24039 if (ret_var.is_owned) {
24045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24046 LDKNodeAnnouncementInfo obj_conv;
24047 obj_conv.inner = (void*)(obj & (~1));
24048 obj_conv.is_owned = false;
24049 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24050 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24051 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24052 CVec_u8Z_free(ret_var);
24056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24057 LDKu8slice ser_ref;
24058 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24059 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24060 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24061 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24062 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24063 return (uint64_t)ret_conv;
24066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24067 LDKNodeInfo this_obj_conv;
24068 this_obj_conv.inner = (void*)(this_obj & (~1));
24069 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24070 NodeInfo_free(this_obj_conv);
24073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24074 LDKNodeInfo this_ptr_conv;
24075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24076 this_ptr_conv.is_owned = false;
24077 LDKCVec_u64Z val_constr;
24078 val_constr.datalen = (*env)->GetArrayLength(env, val);
24079 if (val_constr.datalen > 0)
24080 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24082 val_constr.data = NULL;
24083 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24084 for (size_t g = 0; g < val_constr.datalen; g++) {
24085 int64_t val_conv_6 = val_vals[g];
24086 val_constr.data[g] = val_conv_6;
24088 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24089 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24093 LDKNodeInfo this_ptr_conv;
24094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24095 this_ptr_conv.is_owned = false;
24096 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24099 uint64_t ret_ref = (uint64_t)ret_var.inner;
24100 if (ret_var.is_owned) {
24106 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) {
24107 LDKNodeInfo this_ptr_conv;
24108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24109 this_ptr_conv.is_owned = false;
24110 LDKRoutingFees val_conv;
24111 val_conv.inner = (void*)(val & (~1));
24112 val_conv.is_owned = (val & 1) || (val == 0);
24113 val_conv = RoutingFees_clone(&val_conv);
24114 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24118 LDKNodeInfo this_ptr_conv;
24119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24120 this_ptr_conv.is_owned = false;
24121 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24124 uint64_t ret_ref = (uint64_t)ret_var.inner;
24125 if (ret_var.is_owned) {
24131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24132 LDKNodeInfo this_ptr_conv;
24133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24134 this_ptr_conv.is_owned = false;
24135 LDKNodeAnnouncementInfo val_conv;
24136 val_conv.inner = (void*)(val & (~1));
24137 val_conv.is_owned = (val & 1) || (val == 0);
24138 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24139 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24142 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) {
24143 LDKCVec_u64Z channels_arg_constr;
24144 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24145 if (channels_arg_constr.datalen > 0)
24146 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24148 channels_arg_constr.data = NULL;
24149 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24150 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24151 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24152 channels_arg_constr.data[g] = channels_arg_conv_6;
24154 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24155 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24156 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24157 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24158 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24159 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24160 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24161 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24162 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24163 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24166 uint64_t ret_ref = (uint64_t)ret_var.inner;
24167 if (ret_var.is_owned) {
24173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24174 LDKNodeInfo orig_conv;
24175 orig_conv.inner = (void*)(orig & (~1));
24176 orig_conv.is_owned = false;
24177 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24180 uint64_t ret_ref = (uint64_t)ret_var.inner;
24181 if (ret_var.is_owned) {
24187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24188 LDKNodeInfo obj_conv;
24189 obj_conv.inner = (void*)(obj & (~1));
24190 obj_conv.is_owned = false;
24191 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24192 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24193 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24194 CVec_u8Z_free(ret_var);
24198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24199 LDKu8slice ser_ref;
24200 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24201 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24202 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24203 *ret_conv = NodeInfo_read(ser_ref);
24204 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24205 return (uint64_t)ret_conv;
24208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24209 LDKNetworkGraph obj_conv;
24210 obj_conv.inner = (void*)(obj & (~1));
24211 obj_conv.is_owned = false;
24212 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24213 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24214 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24215 CVec_u8Z_free(ret_var);
24219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24220 LDKu8slice ser_ref;
24221 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24222 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24223 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24224 *ret_conv = NetworkGraph_read(ser_ref);
24225 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24226 return (uint64_t)ret_conv;
24229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24230 LDKThirtyTwoBytes genesis_hash_ref;
24231 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24232 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24233 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24236 uint64_t ret_ref = (uint64_t)ret_var.inner;
24237 if (ret_var.is_owned) {
24243 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) {
24244 LDKNetworkGraph this_arg_conv;
24245 this_arg_conv.inner = (void*)(this_arg & (~1));
24246 this_arg_conv.is_owned = false;
24247 LDKNodeAnnouncement msg_conv;
24248 msg_conv.inner = (void*)(msg & (~1));
24249 msg_conv.is_owned = false;
24250 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24251 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24252 return (uint64_t)ret_conv;
24255 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) {
24256 LDKNetworkGraph this_arg_conv;
24257 this_arg_conv.inner = (void*)(this_arg & (~1));
24258 this_arg_conv.is_owned = false;
24259 LDKUnsignedNodeAnnouncement msg_conv;
24260 msg_conv.inner = (void*)(msg & (~1));
24261 msg_conv.is_owned = false;
24262 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24263 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24264 return (uint64_t)ret_conv;
24267 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) {
24268 LDKNetworkGraph this_arg_conv;
24269 this_arg_conv.inner = (void*)(this_arg & (~1));
24270 this_arg_conv.is_owned = false;
24271 LDKChannelAnnouncement msg_conv;
24272 msg_conv.inner = (void*)(msg & (~1));
24273 msg_conv.is_owned = false;
24274 LDKAccess *chain_access_conv_ptr = NULL;
24275 if (chain_access != 0) {
24276 LDKAccess chain_access_conv;
24277 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24278 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24279 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24280 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24282 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24283 *chain_access_conv_ptr = chain_access_conv;
24285 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24286 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24287 return (uint64_t)ret_conv;
24290 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) {
24291 LDKNetworkGraph this_arg_conv;
24292 this_arg_conv.inner = (void*)(this_arg & (~1));
24293 this_arg_conv.is_owned = false;
24294 LDKUnsignedChannelAnnouncement msg_conv;
24295 msg_conv.inner = (void*)(msg & (~1));
24296 msg_conv.is_owned = false;
24297 LDKAccess *chain_access_conv_ptr = NULL;
24298 if (chain_access != 0) {
24299 LDKAccess chain_access_conv;
24300 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24301 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24302 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24303 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24305 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24306 *chain_access_conv_ptr = chain_access_conv;
24308 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24309 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24310 return (uint64_t)ret_conv;
24313 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) {
24314 LDKNetworkGraph this_arg_conv;
24315 this_arg_conv.inner = (void*)(this_arg & (~1));
24316 this_arg_conv.is_owned = false;
24317 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24321 LDKNetworkGraph this_arg_conv;
24322 this_arg_conv.inner = (void*)(this_arg & (~1));
24323 this_arg_conv.is_owned = false;
24324 LDKChannelUpdate msg_conv;
24325 msg_conv.inner = (void*)(msg & (~1));
24326 msg_conv.is_owned = false;
24327 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24328 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24329 return (uint64_t)ret_conv;
24332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24333 LDKNetworkGraph this_arg_conv;
24334 this_arg_conv.inner = (void*)(this_arg & (~1));
24335 this_arg_conv.is_owned = false;
24336 LDKUnsignedChannelUpdate msg_conv;
24337 msg_conv.inner = (void*)(msg & (~1));
24338 msg_conv.is_owned = false;
24339 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24340 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24341 return (uint64_t)ret_conv;
24344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24345 LDKFilesystemPersister this_obj_conv;
24346 this_obj_conv.inner = (void*)(this_obj & (~1));
24347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24348 FilesystemPersister_free(this_obj_conv);
24351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24352 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24353 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24356 uint64_t ret_ref = (uint64_t)ret_var.inner;
24357 if (ret_var.is_owned) {
24363 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24364 LDKFilesystemPersister this_arg_conv;
24365 this_arg_conv.inner = (void*)(this_arg & (~1));
24366 this_arg_conv.is_owned = false;
24367 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24368 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24373 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24374 LDKChannelManager manager_conv;
24375 manager_conv.inner = (void*)(manager & (~1));
24376 manager_conv.is_owned = false;
24377 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24378 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24379 return (uint64_t)ret_conv;
24382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24383 LDKFilesystemPersister this_arg_conv;
24384 this_arg_conv.inner = (void*)(this_arg & (~1));
24385 this_arg_conv.is_owned = false;
24386 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24387 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24388 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24389 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24391 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24392 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24393 return (uint64_t)ret_conv;
24396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24397 LDKFilesystemPersister this_arg_conv;
24398 this_arg_conv.inner = (void*)(this_arg & (~1));
24399 this_arg_conv.is_owned = false;
24400 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24401 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24402 return (uint64_t)ret;
24405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24406 LDKBackgroundProcessor this_obj_conv;
24407 this_obj_conv.inner = (void*)(this_obj & (~1));
24408 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24409 BackgroundProcessor_free(this_obj_conv);
24412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24413 if ((this_ptr & 1) != 0) return;
24414 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24415 FREE((void*)this_ptr);
24416 ChannelManagerPersister_free(this_ptr_conv);
24419 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) {
24420 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24421 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24423 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24425 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24426 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24427 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24428 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24430 LDKChainMonitor chain_monitor_conv;
24431 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24432 chain_monitor_conv.is_owned = false;
24433 LDKChannelManager channel_manager_conv;
24434 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24435 channel_manager_conv.is_owned = false;
24436 LDKPeerManager peer_manager_conv;
24437 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24438 peer_manager_conv.is_owned = false;
24439 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24440 if (logger_conv.free == LDKLogger_JCalls_free) {
24441 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24442 LDKLogger_JCalls_clone(logger_conv.this_arg);
24444 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24447 uint64_t ret_ref = (uint64_t)ret_var.inner;
24448 if (ret_var.is_owned) {
24454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24455 LDKBackgroundProcessor this_arg_conv;
24456 this_arg_conv.inner = (void*)(this_arg & (~1));
24457 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24458 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24459 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24460 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24461 return (uint64_t)ret_conv;
24464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24469 LDKInvoice this_obj_conv;
24470 this_obj_conv.inner = (void*)(this_obj & (~1));
24471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24472 Invoice_free(this_obj_conv);
24475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24477 a_conv.inner = (void*)(a & (~1));
24478 a_conv.is_owned = false;
24480 b_conv.inner = (void*)(b & (~1));
24481 b_conv.is_owned = false;
24482 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24487 LDKInvoice orig_conv;
24488 orig_conv.inner = (void*)(orig & (~1));
24489 orig_conv.is_owned = false;
24490 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24493 uint64_t ret_ref = (uint64_t)ret_var.inner;
24494 if (ret_var.is_owned) {
24500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24501 LDKSignedRawInvoice this_obj_conv;
24502 this_obj_conv.inner = (void*)(this_obj & (~1));
24503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24504 SignedRawInvoice_free(this_obj_conv);
24507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24508 LDKSignedRawInvoice a_conv;
24509 a_conv.inner = (void*)(a & (~1));
24510 a_conv.is_owned = false;
24511 LDKSignedRawInvoice b_conv;
24512 b_conv.inner = (void*)(b & (~1));
24513 b_conv.is_owned = false;
24514 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24519 LDKSignedRawInvoice orig_conv;
24520 orig_conv.inner = (void*)(orig & (~1));
24521 orig_conv.is_owned = false;
24522 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24525 uint64_t ret_ref = (uint64_t)ret_var.inner;
24526 if (ret_var.is_owned) {
24532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24533 LDKRawInvoice this_obj_conv;
24534 this_obj_conv.inner = (void*)(this_obj & (~1));
24535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24536 RawInvoice_free(this_obj_conv);
24539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24540 LDKRawInvoice this_ptr_conv;
24541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24542 this_ptr_conv.is_owned = false;
24543 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24546 uint64_t ret_ref = (uint64_t)ret_var.inner;
24547 if (ret_var.is_owned) {
24553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24554 LDKRawInvoice this_ptr_conv;
24555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24556 this_ptr_conv.is_owned = false;
24557 LDKRawDataPart val_conv;
24558 val_conv.inner = (void*)(val & (~1));
24559 val_conv.is_owned = (val & 1) || (val == 0);
24560 val_conv = RawDataPart_clone(&val_conv);
24561 RawInvoice_set_data(&this_ptr_conv, val_conv);
24564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24565 LDKRawInvoice a_conv;
24566 a_conv.inner = (void*)(a & (~1));
24567 a_conv.is_owned = false;
24568 LDKRawInvoice b_conv;
24569 b_conv.inner = (void*)(b & (~1));
24570 b_conv.is_owned = false;
24571 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24576 LDKRawInvoice orig_conv;
24577 orig_conv.inner = (void*)(orig & (~1));
24578 orig_conv.is_owned = false;
24579 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24582 uint64_t ret_ref = (uint64_t)ret_var.inner;
24583 if (ret_var.is_owned) {
24589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24590 LDKRawDataPart this_obj_conv;
24591 this_obj_conv.inner = (void*)(this_obj & (~1));
24592 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24593 RawDataPart_free(this_obj_conv);
24596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24597 LDKRawDataPart this_ptr_conv;
24598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24599 this_ptr_conv.is_owned = false;
24600 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24603 uint64_t ret_ref = (uint64_t)ret_var.inner;
24604 if (ret_var.is_owned) {
24610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24611 LDKRawDataPart this_ptr_conv;
24612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24613 this_ptr_conv.is_owned = false;
24614 LDKPositiveTimestamp val_conv;
24615 val_conv.inner = (void*)(val & (~1));
24616 val_conv.is_owned = (val & 1) || (val == 0);
24617 val_conv = PositiveTimestamp_clone(&val_conv);
24618 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24622 LDKRawDataPart a_conv;
24623 a_conv.inner = (void*)(a & (~1));
24624 a_conv.is_owned = false;
24625 LDKRawDataPart b_conv;
24626 b_conv.inner = (void*)(b & (~1));
24627 b_conv.is_owned = false;
24628 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24633 LDKRawDataPart orig_conv;
24634 orig_conv.inner = (void*)(orig & (~1));
24635 orig_conv.is_owned = false;
24636 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24639 uint64_t ret_ref = (uint64_t)ret_var.inner;
24640 if (ret_var.is_owned) {
24646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24647 LDKPositiveTimestamp this_obj_conv;
24648 this_obj_conv.inner = (void*)(this_obj & (~1));
24649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24650 PositiveTimestamp_free(this_obj_conv);
24653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24654 LDKPositiveTimestamp a_conv;
24655 a_conv.inner = (void*)(a & (~1));
24656 a_conv.is_owned = false;
24657 LDKPositiveTimestamp b_conv;
24658 b_conv.inner = (void*)(b & (~1));
24659 b_conv.is_owned = false;
24660 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24665 LDKPositiveTimestamp orig_conv;
24666 orig_conv.inner = (void*)(orig & (~1));
24667 orig_conv.is_owned = false;
24668 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24671 uint64_t ret_ref = (uint64_t)ret_var.inner;
24672 if (ret_var.is_owned) {
24678 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24679 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24680 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24685 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24686 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24687 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24692 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24693 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24697 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24698 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
24699 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
24703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24704 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
24705 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
24706 jboolean ret_val = Currency_eq(a_conv, b_conv);
24710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24711 LDKSha256 this_obj_conv;
24712 this_obj_conv.inner = (void*)(this_obj & (~1));
24713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24714 Sha256_free(this_obj_conv);
24717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24719 a_conv.inner = (void*)(a & (~1));
24720 a_conv.is_owned = false;
24722 b_conv.inner = (void*)(b & (~1));
24723 b_conv.is_owned = false;
24724 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
24728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24729 LDKSha256 orig_conv;
24730 orig_conv.inner = (void*)(orig & (~1));
24731 orig_conv.is_owned = false;
24732 LDKSha256 ret_var = Sha256_clone(&orig_conv);
24733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24735 uint64_t ret_ref = (uint64_t)ret_var.inner;
24736 if (ret_var.is_owned) {
24742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24743 LDKDescription this_obj_conv;
24744 this_obj_conv.inner = (void*)(this_obj & (~1));
24745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24746 Description_free(this_obj_conv);
24749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24750 LDKDescription a_conv;
24751 a_conv.inner = (void*)(a & (~1));
24752 a_conv.is_owned = false;
24753 LDKDescription b_conv;
24754 b_conv.inner = (void*)(b & (~1));
24755 b_conv.is_owned = false;
24756 jboolean ret_val = Description_eq(&a_conv, &b_conv);
24760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24761 LDKDescription orig_conv;
24762 orig_conv.inner = (void*)(orig & (~1));
24763 orig_conv.is_owned = false;
24764 LDKDescription ret_var = Description_clone(&orig_conv);
24765 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24766 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24767 uint64_t ret_ref = (uint64_t)ret_var.inner;
24768 if (ret_var.is_owned) {
24774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24775 LDKPayeePubKey this_obj_conv;
24776 this_obj_conv.inner = (void*)(this_obj & (~1));
24777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24778 PayeePubKey_free(this_obj_conv);
24781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24782 LDKPayeePubKey a_conv;
24783 a_conv.inner = (void*)(a & (~1));
24784 a_conv.is_owned = false;
24785 LDKPayeePubKey b_conv;
24786 b_conv.inner = (void*)(b & (~1));
24787 b_conv.is_owned = false;
24788 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
24792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24793 LDKPayeePubKey orig_conv;
24794 orig_conv.inner = (void*)(orig & (~1));
24795 orig_conv.is_owned = false;
24796 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
24797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24799 uint64_t ret_ref = (uint64_t)ret_var.inner;
24800 if (ret_var.is_owned) {
24806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24807 LDKExpiryTime this_obj_conv;
24808 this_obj_conv.inner = (void*)(this_obj & (~1));
24809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24810 ExpiryTime_free(this_obj_conv);
24813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24814 LDKExpiryTime a_conv;
24815 a_conv.inner = (void*)(a & (~1));
24816 a_conv.is_owned = false;
24817 LDKExpiryTime b_conv;
24818 b_conv.inner = (void*)(b & (~1));
24819 b_conv.is_owned = false;
24820 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
24824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24825 LDKExpiryTime orig_conv;
24826 orig_conv.inner = (void*)(orig & (~1));
24827 orig_conv.is_owned = false;
24828 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
24829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24831 uint64_t ret_ref = (uint64_t)ret_var.inner;
24832 if (ret_var.is_owned) {
24838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24839 LDKMinFinalCltvExpiry this_obj_conv;
24840 this_obj_conv.inner = (void*)(this_obj & (~1));
24841 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24842 MinFinalCltvExpiry_free(this_obj_conv);
24845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24846 LDKMinFinalCltvExpiry a_conv;
24847 a_conv.inner = (void*)(a & (~1));
24848 a_conv.is_owned = false;
24849 LDKMinFinalCltvExpiry b_conv;
24850 b_conv.inner = (void*)(b & (~1));
24851 b_conv.is_owned = false;
24852 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
24856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24857 LDKMinFinalCltvExpiry orig_conv;
24858 orig_conv.inner = (void*)(orig & (~1));
24859 orig_conv.is_owned = false;
24860 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
24861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24863 uint64_t ret_ref = (uint64_t)ret_var.inner;
24864 if (ret_var.is_owned) {
24870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24871 if ((this_ptr & 1) != 0) return;
24872 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
24873 FREE((void*)this_ptr);
24874 Fallback_free(this_ptr_conv);
24877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24878 LDKFallback* orig_conv = (LDKFallback*)orig;
24879 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24880 *ret_copy = Fallback_clone(orig_conv);
24881 uint64_t ret_ref = (uint64_t)ret_copy;
24885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24886 LDKFallback* a_conv = (LDKFallback*)a;
24887 LDKFallback* b_conv = (LDKFallback*)b;
24888 jboolean ret_val = Fallback_eq(a_conv, b_conv);
24892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24893 LDKInvoiceSignature this_obj_conv;
24894 this_obj_conv.inner = (void*)(this_obj & (~1));
24895 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24896 InvoiceSignature_free(this_obj_conv);
24899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24900 LDKInvoiceSignature a_conv;
24901 a_conv.inner = (void*)(a & (~1));
24902 a_conv.is_owned = false;
24903 LDKInvoiceSignature b_conv;
24904 b_conv.inner = (void*)(b & (~1));
24905 b_conv.is_owned = false;
24906 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
24910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24911 LDKInvoiceSignature orig_conv;
24912 orig_conv.inner = (void*)(orig & (~1));
24913 orig_conv.is_owned = false;
24914 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
24915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24917 uint64_t ret_ref = (uint64_t)ret_var.inner;
24918 if (ret_var.is_owned) {
24924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24925 LDKPrivateRoute this_obj_conv;
24926 this_obj_conv.inner = (void*)(this_obj & (~1));
24927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24928 PrivateRoute_free(this_obj_conv);
24931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24932 LDKPrivateRoute a_conv;
24933 a_conv.inner = (void*)(a & (~1));
24934 a_conv.is_owned = false;
24935 LDKPrivateRoute b_conv;
24936 b_conv.inner = (void*)(b & (~1));
24937 b_conv.is_owned = false;
24938 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
24942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24943 LDKPrivateRoute orig_conv;
24944 orig_conv.inner = (void*)(orig & (~1));
24945 orig_conv.is_owned = false;
24946 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
24947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24949 uint64_t ret_ref = (uint64_t)ret_var.inner;
24950 if (ret_var.is_owned) {
24956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
24957 LDKSignedRawInvoice this_arg_conv;
24958 this_arg_conv.inner = (void*)(this_arg & (~1));
24959 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24960 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
24961 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
24962 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
24963 return (uint64_t)ret_ref;
24966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
24967 LDKSignedRawInvoice this_arg_conv;
24968 this_arg_conv.inner = (void*)(this_arg & (~1));
24969 this_arg_conv.is_owned = false;
24970 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
24971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24973 uint64_t ret_ref = (uint64_t)ret_var.inner;
24974 if (ret_var.is_owned) {
24980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24981 LDKSignedRawInvoice this_arg_conv;
24982 this_arg_conv.inner = (void*)(this_arg & (~1));
24983 this_arg_conv.is_owned = false;
24984 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
24989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
24990 LDKSignedRawInvoice this_arg_conv;
24991 this_arg_conv.inner = (void*)(this_arg & (~1));
24992 this_arg_conv.is_owned = false;
24993 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
24994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24996 uint64_t ret_ref = (uint64_t)ret_var.inner;
24997 if (ret_var.is_owned) {
25003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25004 LDKSignedRawInvoice this_arg_conv;
25005 this_arg_conv.inner = (void*)(this_arg & (~1));
25006 this_arg_conv.is_owned = false;
25007 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25008 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25009 return (uint64_t)ret_conv;
25012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25013 LDKSignedRawInvoice this_arg_conv;
25014 this_arg_conv.inner = (void*)(this_arg & (~1));
25015 this_arg_conv.is_owned = false;
25016 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25021 LDKRawInvoice this_arg_conv;
25022 this_arg_conv.inner = (void*)(this_arg & (~1));
25023 this_arg_conv.is_owned = false;
25024 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25030 LDKRawInvoice this_arg_conv;
25031 this_arg_conv.inner = (void*)(this_arg & (~1));
25032 this_arg_conv.is_owned = false;
25033 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25034 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25035 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25036 uint64_t ret_ref = (uint64_t)ret_var.inner;
25037 if (ret_var.is_owned) {
25043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25044 LDKRawInvoice this_arg_conv;
25045 this_arg_conv.inner = (void*)(this_arg & (~1));
25046 this_arg_conv.is_owned = false;
25047 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25050 uint64_t ret_ref = (uint64_t)ret_var.inner;
25051 if (ret_var.is_owned) {
25057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25058 LDKRawInvoice this_arg_conv;
25059 this_arg_conv.inner = (void*)(this_arg & (~1));
25060 this_arg_conv.is_owned = false;
25061 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25064 uint64_t ret_ref = (uint64_t)ret_var.inner;
25065 if (ret_var.is_owned) {
25071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25072 LDKRawInvoice this_arg_conv;
25073 this_arg_conv.inner = (void*)(this_arg & (~1));
25074 this_arg_conv.is_owned = false;
25075 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25078 uint64_t ret_ref = (uint64_t)ret_var.inner;
25079 if (ret_var.is_owned) {
25085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25086 LDKRawInvoice this_arg_conv;
25087 this_arg_conv.inner = (void*)(this_arg & (~1));
25088 this_arg_conv.is_owned = false;
25089 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25092 uint64_t ret_ref = (uint64_t)ret_var.inner;
25093 if (ret_var.is_owned) {
25099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25100 LDKRawInvoice this_arg_conv;
25101 this_arg_conv.inner = (void*)(this_arg & (~1));
25102 this_arg_conv.is_owned = false;
25103 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25106 uint64_t ret_ref = (uint64_t)ret_var.inner;
25107 if (ret_var.is_owned) {
25113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25114 LDKRawInvoice this_arg_conv;
25115 this_arg_conv.inner = (void*)(this_arg & (~1));
25116 this_arg_conv.is_owned = false;
25117 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25118 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25123 LDKRawInvoice this_arg_conv;
25124 this_arg_conv.inner = (void*)(this_arg & (~1));
25125 this_arg_conv.is_owned = false;
25126 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25129 uint64_t ret_ref = (uint64_t)ret_var.inner;
25130 if (ret_var.is_owned) {
25136 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25137 LDKRawInvoice this_arg_conv;
25138 this_arg_conv.inner = (void*)(this_arg & (~1));
25139 this_arg_conv.is_owned = false;
25140 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25141 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25142 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25143 for (size_t o = 0; o < ret_var.datalen; o++) {
25144 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25145 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25146 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25147 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25148 if (ret_conv_14_var.is_owned) {
25149 ret_conv_14_ref |= 1;
25151 ret_arr_ptr[o] = ret_conv_14_ref;
25153 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25154 FREE(ret_var.data);
25158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25159 LDKRawInvoice this_arg_conv;
25160 this_arg_conv.inner = (void*)(this_arg & (~1));
25161 this_arg_conv.is_owned = false;
25162 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25163 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25164 uint64_t ret_ref = (uint64_t)ret_copy;
25168 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25169 LDKRawInvoice this_arg_conv;
25170 this_arg_conv.inner = (void*)(this_arg & (~1));
25171 this_arg_conv.is_owned = false;
25172 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25177 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25178 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25179 return (uint64_t)ret_conv;
25182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25183 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25184 *ret_conv = PositiveTimestamp_from_system_time(time);
25185 return (uint64_t)ret_conv;
25188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25189 LDKPositiveTimestamp this_arg_conv;
25190 this_arg_conv.inner = (void*)(this_arg & (~1));
25191 this_arg_conv.is_owned = false;
25192 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25197 LDKPositiveTimestamp this_arg_conv;
25198 this_arg_conv.inner = (void*)(this_arg & (~1));
25199 this_arg_conv.is_owned = false;
25200 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25205 LDKInvoice this_arg_conv;
25206 this_arg_conv.inner = (void*)(this_arg & (~1));
25207 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25208 this_arg_conv = Invoice_clone(&this_arg_conv);
25209 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25212 uint64_t ret_ref = (uint64_t)ret_var.inner;
25213 if (ret_var.is_owned) {
25219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25220 LDKInvoice this_arg_conv;
25221 this_arg_conv.inner = (void*)(this_arg & (~1));
25222 this_arg_conv.is_owned = false;
25223 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25224 *ret_conv = Invoice_check_signature(&this_arg_conv);
25225 return (uint64_t)ret_conv;
25228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25229 LDKSignedRawInvoice signed_invoice_conv;
25230 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25231 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25232 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25233 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25234 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25235 return (uint64_t)ret_conv;
25238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25239 LDKInvoice this_arg_conv;
25240 this_arg_conv.inner = (void*)(this_arg & (~1));
25241 this_arg_conv.is_owned = false;
25242 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25247 LDKInvoice this_arg_conv;
25248 this_arg_conv.inner = (void*)(this_arg & (~1));
25249 this_arg_conv.is_owned = false;
25250 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25251 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25256 LDKInvoice this_arg_conv;
25257 this_arg_conv.inner = (void*)(this_arg & (~1));
25258 this_arg_conv.is_owned = false;
25259 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25265 LDKInvoice this_arg_conv;
25266 this_arg_conv.inner = (void*)(this_arg & (~1));
25267 this_arg_conv.is_owned = false;
25268 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25269 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25274 LDKInvoice this_arg_conv;
25275 this_arg_conv.inner = (void*)(this_arg & (~1));
25276 this_arg_conv.is_owned = false;
25277 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25280 uint64_t ret_ref = (uint64_t)ret_var.inner;
25281 if (ret_var.is_owned) {
25287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25288 LDKInvoice this_arg_conv;
25289 this_arg_conv.inner = (void*)(this_arg & (~1));
25290 this_arg_conv.is_owned = false;
25291 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25292 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25297 LDKInvoice this_arg_conv;
25298 this_arg_conv.inner = (void*)(this_arg & (~1));
25299 this_arg_conv.is_owned = false;
25300 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25305 LDKInvoice this_arg_conv;
25306 this_arg_conv.inner = (void*)(this_arg & (~1));
25307 this_arg_conv.is_owned = false;
25308 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25312 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25313 LDKInvoice this_arg_conv;
25314 this_arg_conv.inner = (void*)(this_arg & (~1));
25315 this_arg_conv.is_owned = false;
25316 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
25317 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25318 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25319 for (size_t o = 0; o < ret_var.datalen; o++) {
25320 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25321 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25322 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25323 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25324 if (ret_conv_14_var.is_owned) {
25325 ret_conv_14_ref |= 1;
25327 ret_arr_ptr[o] = ret_conv_14_ref;
25329 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25330 FREE(ret_var.data);
25334 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
25335 LDKInvoice this_arg_conv;
25336 this_arg_conv.inner = (void*)(this_arg & (~1));
25337 this_arg_conv.is_owned = false;
25338 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
25339 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25340 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25341 for (size_t l = 0; l < ret_var.datalen; l++) {
25342 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25343 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25344 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25345 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25346 if (ret_conv_11_var.is_owned) {
25347 ret_conv_11_ref |= 1;
25349 ret_arr_ptr[l] = ret_conv_11_ref;
25351 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25352 FREE(ret_var.data);
25356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25357 LDKInvoice this_arg_conv;
25358 this_arg_conv.inner = (void*)(this_arg & (~1));
25359 this_arg_conv.is_owned = false;
25360 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25365 LDKInvoice this_arg_conv;
25366 this_arg_conv.inner = (void*)(this_arg & (~1));
25367 this_arg_conv.is_owned = false;
25368 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25369 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25370 uint64_t ret_ref = (uint64_t)ret_copy;
25374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25375 LDKStr description_conv = java_to_owned_str(env, description);
25376 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25377 *ret_conv = Description_new(description_conv);
25378 return (uint64_t)ret_conv;
25381 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25382 LDKDescription this_arg_conv;
25383 this_arg_conv.inner = (void*)(this_arg & (~1));
25384 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25385 this_arg_conv = Description_clone(&this_arg_conv);
25386 LDKStr ret_str = Description_into_inner(this_arg_conv);
25387 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25392 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25393 *ret_conv = ExpiryTime_from_seconds(seconds);
25394 return (uint64_t)ret_conv;
25397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25398 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25399 *ret_conv = ExpiryTime_from_duration(duration);
25400 return (uint64_t)ret_conv;
25403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25404 LDKExpiryTime this_arg_conv;
25405 this_arg_conv.inner = (void*)(this_arg & (~1));
25406 this_arg_conv.is_owned = false;
25407 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25412 LDKExpiryTime this_arg_conv;
25413 this_arg_conv.inner = (void*)(this_arg & (~1));
25414 this_arg_conv.is_owned = false;
25415 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
25420 LDKRouteHint hops_conv;
25421 hops_conv.inner = (void*)(hops & (~1));
25422 hops_conv.is_owned = (hops & 1) || (hops == 0);
25423 hops_conv = RouteHint_clone(&hops_conv);
25424 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
25425 *ret_conv = PrivateRoute_new(hops_conv);
25426 return (uint64_t)ret_conv;
25429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25430 LDKPrivateRoute this_arg_conv;
25431 this_arg_conv.inner = (void*)(this_arg & (~1));
25432 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25433 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
25434 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
25435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25437 uint64_t ret_ref = (uint64_t)ret_var.inner;
25438 if (ret_var.is_owned) {
25444 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25445 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25446 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25451 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25452 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25453 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25457 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25458 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25459 LDKStr ret_str = CreationError_to_str(o_conv);
25460 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25464 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25465 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25466 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25471 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25472 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25473 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25477 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25478 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25479 LDKStr ret_str = SemanticError_to_str(o_conv);
25480 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25485 if ((this_ptr & 1) != 0) return;
25486 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25487 FREE((void*)this_ptr);
25488 SignOrCreationError_free(this_ptr_conv);
25491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25492 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25493 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25494 *ret_copy = SignOrCreationError_clone(orig_conv);
25495 uint64_t ret_ref = (uint64_t)ret_copy;
25499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25500 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25501 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25502 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25506 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25507 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25508 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25509 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25513 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) {
25514 LDKChannelManager channelmanager_conv;
25515 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25516 channelmanager_conv.is_owned = false;
25517 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25518 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25519 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25520 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25522 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25523 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25524 LDKStr description_conv = java_to_owned_str(env, description);
25525 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25526 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25527 return (uint64_t)ret_conv;
25530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25531 LDKStr s_conv = java_to_owned_str(env, s);
25532 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25533 *ret_conv = SiPrefix_from_str(s_conv);
25534 return (uint64_t)ret_conv;
25537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25538 LDKStr s_conv = java_to_owned_str(env, s);
25539 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25540 *ret_conv = Invoice_from_str(s_conv);
25541 return (uint64_t)ret_conv;
25544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25545 LDKStr s_conv = java_to_owned_str(env, s);
25546 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25547 *ret_conv = SignedRawInvoice_from_str(s_conv);
25548 return (uint64_t)ret_conv;
25551 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25553 o_conv.inner = (void*)(o & (~1));
25554 o_conv.is_owned = false;
25555 LDKStr ret_str = Invoice_to_str(&o_conv);
25556 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25560 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25561 LDKSignedRawInvoice o_conv;
25562 o_conv.inner = (void*)(o & (~1));
25563 o_conv.is_owned = false;
25564 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25565 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25569 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25570 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25571 LDKStr ret_str = Currency_to_str(o_conv);
25572 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25576 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25577 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25578 LDKStr ret_str = SiPrefix_to_str(o_conv);
25579 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);