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 LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
21 static jmethodID ordinal_meth = NULL;
22 static jmethodID slicedef_meth = NULL;
23 static jclass slicedef_cls = NULL;
24 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
25 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
26 CHECK(ordinal_meth != NULL);
27 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
28 CHECK(slicedef_meth != NULL);
29 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
30 CHECK(slicedef_cls != NULL);
33 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
39 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
43 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
44 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
47 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
48 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
49 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
50 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
53 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
54 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
55 vec->datalen = (*env)->GetArrayLength(env, bytes);
56 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
57 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
60 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
61 LDKTransaction *txdata = (LDKTransaction*)ptr;
63 slice.data = txdata->data;
64 slice.datalen = txdata->datalen;
65 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
67 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
68 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
69 txdata->datalen = (*env)->GetArrayLength(env, bytes);
70 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
71 txdata->data_is_owned = false;
72 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
73 return (uint64_t)txdata;
75 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
76 LDKTransaction *tx = (LDKTransaction*)ptr;
77 tx->data_is_owned = true;
78 Transaction_free(*tx);
81 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
82 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
84 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
85 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
86 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
87 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
88 return (uint64_t)vec->datalen;
90 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
91 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
93 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
94 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
96 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
102 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
103 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
108 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
109 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
111 typedef jlongArray int64_tArray;
112 typedef jbyteArray int8_tArray;
114 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
115 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
116 char* conv_buf = MALLOC(len + 1, "str conv buf");
117 memcpy(conv_buf, chars, len);
119 jstring ret = (*env)->NewStringUTF(env, conv_buf);
123 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
124 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
125 char* newchars = MALLOC(str_len + 1, "String chars");
126 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
127 memcpy(newchars, jchars, str_len);
128 newchars[str_len] = 0;
129 (*env)->ReleaseStringUTFChars(env, str, jchars);
133 .chars_is_owned = true
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
145 static jclass arr_of_B_clz = NULL;
146 static jclass arr_of_J_clz = NULL;
147 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
148 arr_of_B_clz = (*env)->FindClass(env, "[B");
149 CHECK(arr_of_B_clz != NULL);
150 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
151 arr_of_J_clz = (*env)->FindClass(env, "[J");
152 CHECK(arr_of_J_clz != NULL);
153 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
155 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
156 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
157 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
158 if (UNLIKELY((*env)->ExceptionCheck(env))) {
159 (*env)->ExceptionDescribe(env);
160 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
163 case 0: return LDKAccessError_UnknownChain;
164 case 1: return LDKAccessError_UnknownTx;
166 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
167 abort(); // Unreachable, but will let the compiler know we don't return here
169 static jclass AccessError_class = NULL;
170 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
171 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
172 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
173 AccessError_class = (*env)->NewGlobalRef(env, clz);
174 CHECK(AccessError_class != NULL);
175 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
176 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
177 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
178 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
180 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
182 case LDKAccessError_UnknownChain:
183 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
184 case LDKAccessError_UnknownTx:
185 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
190 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
191 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
192 if (UNLIKELY((*env)->ExceptionCheck(env))) {
193 (*env)->ExceptionDescribe(env);
194 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
197 case 0: return LDKCOption_NoneZ_Some;
198 case 1: return LDKCOption_NoneZ_None;
200 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
201 abort(); // Unreachable, but will let the compiler know we don't return here
203 static jclass COption_NoneZ_class = NULL;
204 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
205 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
206 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
207 COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
208 CHECK(COption_NoneZ_class != NULL);
209 COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
210 CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
211 COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
212 CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
214 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
216 case LDKCOption_NoneZ_Some:
217 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
218 case LDKCOption_NoneZ_None:
219 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
224 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
225 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
226 if (UNLIKELY((*env)->ExceptionCheck(env))) {
227 (*env)->ExceptionDescribe(env);
228 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
231 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
232 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
234 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
235 abort(); // Unreachable, but will let the compiler know we don't return here
237 static jclass ChannelMonitorUpdateErr_class = NULL;
238 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
239 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
240 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
241 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
242 CHECK(ChannelMonitorUpdateErr_class != NULL);
243 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
244 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
245 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
246 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
248 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
250 case LDKChannelMonitorUpdateErr_TemporaryFailure:
251 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
252 case LDKChannelMonitorUpdateErr_PermanentFailure:
253 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
258 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
259 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
260 if (UNLIKELY((*env)->ExceptionCheck(env))) {
261 (*env)->ExceptionDescribe(env);
262 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
265 case 0: return LDKConfirmationTarget_Background;
266 case 1: return LDKConfirmationTarget_Normal;
267 case 2: return LDKConfirmationTarget_HighPriority;
269 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
270 abort(); // Unreachable, but will let the compiler know we don't return here
272 static jclass ConfirmationTarget_class = NULL;
273 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
274 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
275 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
276 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
277 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
278 CHECK(ConfirmationTarget_class != NULL);
279 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
280 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
281 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
282 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
283 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
284 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
286 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
288 case LDKConfirmationTarget_Background:
289 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
290 case LDKConfirmationTarget_Normal:
291 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
292 case LDKConfirmationTarget_HighPriority:
293 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
298 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
299 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
300 if (UNLIKELY((*env)->ExceptionCheck(env))) {
301 (*env)->ExceptionDescribe(env);
302 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
305 case 0: return LDKCreationError_DescriptionTooLong;
306 case 1: return LDKCreationError_RouteTooLong;
307 case 2: return LDKCreationError_TimestampOutOfBounds;
308 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
309 case 4: return LDKCreationError_InvalidAmount;
311 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
312 abort(); // Unreachable, but will let the compiler know we don't return here
314 static jclass CreationError_class = NULL;
315 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
316 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
317 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
318 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
319 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
320 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
321 CreationError_class = (*env)->NewGlobalRef(env, clz);
322 CHECK(CreationError_class != NULL);
323 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
324 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
325 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
326 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
327 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
328 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
329 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
331 CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
334 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
336 case LDKCreationError_DescriptionTooLong:
337 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
338 case LDKCreationError_RouteTooLong:
339 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
340 case LDKCreationError_TimestampOutOfBounds:
341 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
342 case LDKCreationError_ExpiryTimeOutOfBounds:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
344 case LDKCreationError_InvalidAmount:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
350 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
351 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
352 if (UNLIKELY((*env)->ExceptionCheck(env))) {
353 (*env)->ExceptionDescribe(env);
354 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
357 case 0: return LDKCurrency_Bitcoin;
358 case 1: return LDKCurrency_BitcoinTestnet;
359 case 2: return LDKCurrency_Regtest;
360 case 3: return LDKCurrency_Simnet;
361 case 4: return LDKCurrency_Signet;
363 (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
364 abort(); // Unreachable, but will let the compiler know we don't return here
366 static jclass Currency_class = NULL;
367 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
368 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
369 static jfieldID Currency_LDKCurrency_Regtest = NULL;
370 static jfieldID Currency_LDKCurrency_Simnet = NULL;
371 static jfieldID Currency_LDKCurrency_Signet = NULL;
372 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
373 Currency_class = (*env)->NewGlobalRef(env, clz);
374 CHECK(Currency_class != NULL);
375 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
376 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
377 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
378 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
379 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
380 CHECK(Currency_LDKCurrency_Regtest != NULL);
381 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
382 CHECK(Currency_LDKCurrency_Simnet != NULL);
383 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
384 CHECK(Currency_LDKCurrency_Signet != NULL);
386 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
388 case LDKCurrency_Bitcoin:
389 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
390 case LDKCurrency_BitcoinTestnet:
391 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
392 case LDKCurrency_Regtest:
393 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
394 case LDKCurrency_Simnet:
395 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
396 case LDKCurrency_Signet:
397 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
402 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
403 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
405 (*env)->ExceptionDescribe(env);
406 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
409 case 0: return LDKIOError_NotFound;
410 case 1: return LDKIOError_PermissionDenied;
411 case 2: return LDKIOError_ConnectionRefused;
412 case 3: return LDKIOError_ConnectionReset;
413 case 4: return LDKIOError_ConnectionAborted;
414 case 5: return LDKIOError_NotConnected;
415 case 6: return LDKIOError_AddrInUse;
416 case 7: return LDKIOError_AddrNotAvailable;
417 case 8: return LDKIOError_BrokenPipe;
418 case 9: return LDKIOError_AlreadyExists;
419 case 10: return LDKIOError_WouldBlock;
420 case 11: return LDKIOError_InvalidInput;
421 case 12: return LDKIOError_InvalidData;
422 case 13: return LDKIOError_TimedOut;
423 case 14: return LDKIOError_WriteZero;
424 case 15: return LDKIOError_Interrupted;
425 case 16: return LDKIOError_Other;
426 case 17: return LDKIOError_UnexpectedEof;
428 (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
429 abort(); // Unreachable, but will let the compiler know we don't return here
431 static jclass IOError_class = NULL;
432 static jfieldID IOError_LDKIOError_NotFound = NULL;
433 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
434 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
435 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
436 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
437 static jfieldID IOError_LDKIOError_NotConnected = NULL;
438 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
439 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
440 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
441 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
442 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
443 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
444 static jfieldID IOError_LDKIOError_InvalidData = NULL;
445 static jfieldID IOError_LDKIOError_TimedOut = NULL;
446 static jfieldID IOError_LDKIOError_WriteZero = NULL;
447 static jfieldID IOError_LDKIOError_Interrupted = NULL;
448 static jfieldID IOError_LDKIOError_Other = NULL;
449 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
450 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
451 IOError_class = (*env)->NewGlobalRef(env, clz);
452 CHECK(IOError_class != NULL);
453 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
454 CHECK(IOError_LDKIOError_NotFound != NULL);
455 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
456 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
457 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
458 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
459 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
460 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
461 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
462 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
463 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
464 CHECK(IOError_LDKIOError_NotConnected != NULL);
465 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
466 CHECK(IOError_LDKIOError_AddrInUse != NULL);
467 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
468 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
469 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
470 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
471 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
472 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
473 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
474 CHECK(IOError_LDKIOError_WouldBlock != NULL);
475 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
476 CHECK(IOError_LDKIOError_InvalidInput != NULL);
477 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
478 CHECK(IOError_LDKIOError_InvalidData != NULL);
479 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
480 CHECK(IOError_LDKIOError_TimedOut != NULL);
481 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
482 CHECK(IOError_LDKIOError_WriteZero != NULL);
483 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
484 CHECK(IOError_LDKIOError_Interrupted != NULL);
485 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
486 CHECK(IOError_LDKIOError_Other != NULL);
487 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
488 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
490 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
492 case LDKIOError_NotFound:
493 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
494 case LDKIOError_PermissionDenied:
495 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
496 case LDKIOError_ConnectionRefused:
497 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
498 case LDKIOError_ConnectionReset:
499 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
500 case LDKIOError_ConnectionAborted:
501 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
502 case LDKIOError_NotConnected:
503 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
504 case LDKIOError_AddrInUse:
505 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
506 case LDKIOError_AddrNotAvailable:
507 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
508 case LDKIOError_BrokenPipe:
509 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
510 case LDKIOError_AlreadyExists:
511 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
512 case LDKIOError_WouldBlock:
513 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
514 case LDKIOError_InvalidInput:
515 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
516 case LDKIOError_InvalidData:
517 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
518 case LDKIOError_TimedOut:
519 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
520 case LDKIOError_WriteZero:
521 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
522 case LDKIOError_Interrupted:
523 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
524 case LDKIOError_Other:
525 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
526 case LDKIOError_UnexpectedEof:
527 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
532 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
533 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
534 if (UNLIKELY((*env)->ExceptionCheck(env))) {
535 (*env)->ExceptionDescribe(env);
536 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
539 case 0: return LDKLevel_Gossip;
540 case 1: return LDKLevel_Trace;
541 case 2: return LDKLevel_Debug;
542 case 3: return LDKLevel_Info;
543 case 4: return LDKLevel_Warn;
544 case 5: return LDKLevel_Error;
546 (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
547 abort(); // Unreachable, but will let the compiler know we don't return here
549 static jclass Level_class = NULL;
550 static jfieldID Level_LDKLevel_Gossip = NULL;
551 static jfieldID Level_LDKLevel_Trace = NULL;
552 static jfieldID Level_LDKLevel_Debug = NULL;
553 static jfieldID Level_LDKLevel_Info = NULL;
554 static jfieldID Level_LDKLevel_Warn = NULL;
555 static jfieldID Level_LDKLevel_Error = NULL;
556 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
557 Level_class = (*env)->NewGlobalRef(env, clz);
558 CHECK(Level_class != NULL);
559 Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
560 CHECK(Level_LDKLevel_Gossip != NULL);
561 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
562 CHECK(Level_LDKLevel_Trace != NULL);
563 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
564 CHECK(Level_LDKLevel_Debug != NULL);
565 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
566 CHECK(Level_LDKLevel_Info != NULL);
567 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
568 CHECK(Level_LDKLevel_Warn != NULL);
569 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
570 CHECK(Level_LDKLevel_Error != NULL);
572 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
574 case LDKLevel_Gossip:
575 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
577 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
579 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
581 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
583 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
585 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
590 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
591 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
592 if (UNLIKELY((*env)->ExceptionCheck(env))) {
593 (*env)->ExceptionDescribe(env);
594 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
597 case 0: return LDKNetwork_Bitcoin;
598 case 1: return LDKNetwork_Testnet;
599 case 2: return LDKNetwork_Regtest;
600 case 3: return LDKNetwork_Signet;
602 (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
603 abort(); // Unreachable, but will let the compiler know we don't return here
605 static jclass Network_class = NULL;
606 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
607 static jfieldID Network_LDKNetwork_Testnet = NULL;
608 static jfieldID Network_LDKNetwork_Regtest = NULL;
609 static jfieldID Network_LDKNetwork_Signet = NULL;
610 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
611 Network_class = (*env)->NewGlobalRef(env, clz);
612 CHECK(Network_class != NULL);
613 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
614 CHECK(Network_LDKNetwork_Bitcoin != NULL);
615 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
616 CHECK(Network_LDKNetwork_Testnet != NULL);
617 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
618 CHECK(Network_LDKNetwork_Regtest != NULL);
619 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
620 CHECK(Network_LDKNetwork_Signet != NULL);
622 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
624 case LDKNetwork_Bitcoin:
625 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
626 case LDKNetwork_Testnet:
627 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
628 case LDKNetwork_Regtest:
629 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
630 case LDKNetwork_Signet:
631 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
636 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
637 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
638 if (UNLIKELY((*env)->ExceptionCheck(env))) {
639 (*env)->ExceptionDescribe(env);
640 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
643 case 0: return LDKSecp256k1Error_IncorrectSignature;
644 case 1: return LDKSecp256k1Error_InvalidMessage;
645 case 2: return LDKSecp256k1Error_InvalidPublicKey;
646 case 3: return LDKSecp256k1Error_InvalidSignature;
647 case 4: return LDKSecp256k1Error_InvalidSecretKey;
648 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
649 case 6: return LDKSecp256k1Error_InvalidTweak;
650 case 7: return LDKSecp256k1Error_TweakCheckFailed;
651 case 8: return LDKSecp256k1Error_NotEnoughMemory;
653 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
654 abort(); // Unreachable, but will let the compiler know we don't return here
656 static jclass Secp256k1Error_class = NULL;
657 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
658 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
659 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
660 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
661 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
662 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
663 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
664 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
665 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
666 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
667 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
668 CHECK(Secp256k1Error_class != NULL);
669 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
670 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
671 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
672 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
673 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
674 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
675 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
676 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
677 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
678 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
679 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
680 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
681 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
682 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
683 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
684 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
685 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
686 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
688 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
690 case LDKSecp256k1Error_IncorrectSignature:
691 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
692 case LDKSecp256k1Error_InvalidMessage:
693 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
694 case LDKSecp256k1Error_InvalidPublicKey:
695 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
696 case LDKSecp256k1Error_InvalidSignature:
697 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
698 case LDKSecp256k1Error_InvalidSecretKey:
699 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
700 case LDKSecp256k1Error_InvalidRecoveryId:
701 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
702 case LDKSecp256k1Error_InvalidTweak:
703 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
704 case LDKSecp256k1Error_TweakCheckFailed:
705 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
706 case LDKSecp256k1Error_NotEnoughMemory:
707 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
712 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
713 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
714 if (UNLIKELY((*env)->ExceptionCheck(env))) {
715 (*env)->ExceptionDescribe(env);
716 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
719 case 0: return LDKSemanticError_NoPaymentHash;
720 case 1: return LDKSemanticError_MultiplePaymentHashes;
721 case 2: return LDKSemanticError_NoDescription;
722 case 3: return LDKSemanticError_MultipleDescriptions;
723 case 4: return LDKSemanticError_NoPaymentSecret;
724 case 5: return LDKSemanticError_MultiplePaymentSecrets;
725 case 6: return LDKSemanticError_InvalidFeatures;
726 case 7: return LDKSemanticError_InvalidRecoveryId;
727 case 8: return LDKSemanticError_InvalidSignature;
728 case 9: return LDKSemanticError_ImpreciseAmount;
730 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
731 abort(); // Unreachable, but will let the compiler know we don't return here
733 static jclass SemanticError_class = NULL;
734 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
735 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
736 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
737 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
738 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
739 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
740 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
741 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
742 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
743 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
744 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
745 SemanticError_class = (*env)->NewGlobalRef(env, clz);
746 CHECK(SemanticError_class != NULL);
747 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
748 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
749 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
750 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
751 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
752 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
753 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
754 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
755 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
756 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
757 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
758 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
759 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
760 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
761 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
762 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
763 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
764 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
765 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
766 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
768 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
770 case LDKSemanticError_NoPaymentHash:
771 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
772 case LDKSemanticError_MultiplePaymentHashes:
773 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
774 case LDKSemanticError_NoDescription:
775 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
776 case LDKSemanticError_MultipleDescriptions:
777 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
778 case LDKSemanticError_NoPaymentSecret:
779 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
780 case LDKSemanticError_MultiplePaymentSecrets:
781 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
782 case LDKSemanticError_InvalidFeatures:
783 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
784 case LDKSemanticError_InvalidRecoveryId:
785 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
786 case LDKSemanticError_InvalidSignature:
787 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
788 case LDKSemanticError_ImpreciseAmount:
789 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
794 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
795 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
796 if (UNLIKELY((*env)->ExceptionCheck(env))) {
797 (*env)->ExceptionDescribe(env);
798 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
801 case 0: return LDKSiPrefix_Milli;
802 case 1: return LDKSiPrefix_Micro;
803 case 2: return LDKSiPrefix_Nano;
804 case 3: return LDKSiPrefix_Pico;
806 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
807 abort(); // Unreachable, but will let the compiler know we don't return here
809 static jclass SiPrefix_class = NULL;
810 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
811 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
812 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
813 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
814 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
815 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
816 CHECK(SiPrefix_class != NULL);
817 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
818 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
819 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
820 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
821 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
822 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
823 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
824 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
826 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
828 case LDKSiPrefix_Milli:
829 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
830 case LDKSiPrefix_Micro:
831 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
832 case LDKSiPrefix_Nano:
833 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
834 case LDKSiPrefix_Pico:
835 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
840 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
841 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
842 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
845 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
846 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
847 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
850 CVec_u8Z_free(ret_var);
854 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
855 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
856 int64_t ret_val = TxOut_get_value(thing_conv);
860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
861 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
862 CHECK(val->result_ok);
863 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
864 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
867 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
868 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
869 CHECK(!val->result_ok);
870 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
874 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
875 CHECK(val->result_ok);
876 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
877 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
880 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
881 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
882 CHECK(!val->result_ok);
883 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
887 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
888 CHECK(val->result_ok);
889 LDKTxCreationKeys res_var = (*val->contents.result);
890 uint64_t res_ref = 0;
891 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
892 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
893 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
894 res_ref = (uint64_t)res_var.inner & ~1;
897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
898 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
899 CHECK(!val->result_ok);
900 LDKDecodeError err_var = (*val->contents.err);
901 uint64_t err_ref = 0;
902 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
903 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
904 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
905 err_ref = (uint64_t)err_var.inner & ~1;
908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
909 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
910 CHECK(val->result_ok);
911 LDKChannelPublicKeys res_var = (*val->contents.result);
912 uint64_t res_ref = 0;
913 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
914 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
915 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
916 res_ref = (uint64_t)res_var.inner & ~1;
919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
920 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
921 CHECK(!val->result_ok);
922 LDKDecodeError err_var = (*val->contents.err);
923 uint64_t err_ref = 0;
924 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
925 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
926 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
927 err_ref = (uint64_t)err_var.inner & ~1;
930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
931 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
932 CHECK(val->result_ok);
933 LDKTxCreationKeys res_var = (*val->contents.result);
934 uint64_t res_ref = 0;
935 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
936 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
937 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
938 res_ref = (uint64_t)res_var.inner & ~1;
941 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
942 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
943 CHECK(!val->result_ok);
944 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
947 static jclass LDKCOption_u32Z_Some_class = NULL;
948 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
949 static jclass LDKCOption_u32Z_None_class = NULL;
950 static jmethodID LDKCOption_u32Z_None_meth = NULL;
951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
952 LDKCOption_u32Z_Some_class =
953 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
954 CHECK(LDKCOption_u32Z_Some_class != NULL);
955 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
956 CHECK(LDKCOption_u32Z_Some_meth != NULL);
957 LDKCOption_u32Z_None_class =
958 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
959 CHECK(LDKCOption_u32Z_None_class != NULL);
960 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
961 CHECK(LDKCOption_u32Z_None_meth != NULL);
963 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
964 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
966 case LDKCOption_u32Z_Some: {
967 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
969 case LDKCOption_u32Z_None: {
970 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
976 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
977 CHECK(val->result_ok);
978 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
979 uint64_t res_ref = 0;
980 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
983 res_ref = (uint64_t)res_var.inner & ~1;
986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
987 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
988 CHECK(!val->result_ok);
989 LDKDecodeError err_var = (*val->contents.err);
990 uint64_t err_ref = 0;
991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
993 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
994 err_ref = (uint64_t)err_var.inner & ~1;
997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
998 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
999 CHECK(val->result_ok);
1000 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
1001 uint64_t res_ref = 0;
1002 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1003 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1004 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1005 res_ref = (uint64_t)res_var.inner & ~1;
1008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1009 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1010 CHECK(!val->result_ok);
1011 LDKDecodeError err_var = (*val->contents.err);
1012 uint64_t err_ref = 0;
1013 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1014 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1015 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1016 err_ref = (uint64_t)err_var.inner & ~1;
1019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1020 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1021 CHECK(val->result_ok);
1022 LDKChannelTransactionParameters res_var = (*val->contents.result);
1023 uint64_t res_ref = 0;
1024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1026 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1027 res_ref = (uint64_t)res_var.inner & ~1;
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1031 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1032 CHECK(!val->result_ok);
1033 LDKDecodeError err_var = (*val->contents.err);
1034 uint64_t err_ref = 0;
1035 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1036 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1037 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1038 err_ref = (uint64_t)err_var.inner & ~1;
1041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1042 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1043 CHECK(val->result_ok);
1044 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
1045 uint64_t res_ref = 0;
1046 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1047 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1048 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1049 res_ref = (uint64_t)res_var.inner & ~1;
1052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1053 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1054 CHECK(!val->result_ok);
1055 LDKDecodeError err_var = (*val->contents.err);
1056 uint64_t err_ref = 0;
1057 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1058 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1059 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1060 err_ref = (uint64_t)err_var.inner & ~1;
1063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1064 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1065 CHECK(val->result_ok);
1066 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
1067 uint64_t res_ref = 0;
1068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1071 res_ref = (uint64_t)res_var.inner & ~1;
1074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1075 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1076 CHECK(!val->result_ok);
1077 LDKDecodeError err_var = (*val->contents.err);
1078 uint64_t err_ref = 0;
1079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1081 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1082 err_ref = (uint64_t)err_var.inner & ~1;
1085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1086 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
1087 CHECK(val->result_ok);
1088 LDKTrustedClosingTransaction res_var = (*val->contents.result);
1089 uint64_t res_ref = 0;
1090 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1091 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1092 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1093 res_ref = (uint64_t)res_var.inner & ~1;
1096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1097 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
1098 CHECK(!val->result_ok);
1099 return *val->contents.err;
1101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1102 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1103 CHECK(val->result_ok);
1104 LDKCommitmentTransaction res_var = (*val->contents.result);
1105 uint64_t res_ref = 0;
1106 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1109 res_ref = (uint64_t)res_var.inner & ~1;
1112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1113 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1114 CHECK(!val->result_ok);
1115 LDKDecodeError err_var = (*val->contents.err);
1116 uint64_t err_ref = 0;
1117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1119 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1120 err_ref = (uint64_t)err_var.inner & ~1;
1123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1124 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1125 CHECK(val->result_ok);
1126 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1127 uint64_t res_ref = 0;
1128 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1129 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1130 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1131 res_ref = (uint64_t)res_var.inner & ~1;
1134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1135 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1136 CHECK(!val->result_ok);
1137 return *val->contents.err;
1139 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1140 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1141 CHECK(val->result_ok);
1142 LDKCVec_SignatureZ res_var = (*val->contents.result);
1143 jobjectArray res_arr = NULL;
1144 res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1146 for (size_t i = 0; i < res_var.datalen; i++) {
1147 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1148 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1149 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1155 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1156 CHECK(!val->result_ok);
1157 return *val->contents.err;
1159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1160 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1161 CHECK(val->result_ok);
1162 LDKShutdownScript res_var = (*val->contents.result);
1163 uint64_t res_ref = 0;
1164 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1165 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1166 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1167 res_ref = (uint64_t)res_var.inner & ~1;
1170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1171 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1172 CHECK(!val->result_ok);
1173 LDKDecodeError err_var = (*val->contents.err);
1174 uint64_t err_ref = 0;
1175 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1176 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1177 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1178 err_ref = (uint64_t)err_var.inner & ~1;
1181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1182 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1183 CHECK(val->result_ok);
1184 LDKShutdownScript res_var = (*val->contents.result);
1185 uint64_t res_ref = 0;
1186 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1189 res_ref = (uint64_t)res_var.inner & ~1;
1192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1193 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1194 CHECK(!val->result_ok);
1195 LDKInvalidShutdownScript err_var = (*val->contents.err);
1196 uint64_t err_ref = 0;
1197 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1198 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1199 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1200 err_ref = (uint64_t)err_var.inner & ~1;
1203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1204 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1205 CHECK(val->result_ok);
1206 return *val->contents.result;
1208 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1209 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1210 CHECK(!val->result_ok);
1211 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1215 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1216 CHECK(val->result_ok);
1217 LDKRouteHop res_var = (*val->contents.result);
1218 uint64_t res_ref = 0;
1219 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1220 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1221 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1222 res_ref = (uint64_t)res_var.inner & ~1;
1225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1226 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1227 CHECK(!val->result_ok);
1228 LDKDecodeError err_var = (*val->contents.err);
1229 uint64_t err_ref = 0;
1230 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1231 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1232 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1233 err_ref = (uint64_t)err_var.inner & ~1;
1236 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1237 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1238 for (size_t i = 0; i < ret.datalen; i++) {
1239 ret.data[i] = RouteHop_clone(&orig->data[i]);
1243 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1244 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1245 for (size_t i = 0; i < ret.datalen; i++) {
1246 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1251 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1252 CHECK(val->result_ok);
1253 LDKRoute res_var = (*val->contents.result);
1254 uint64_t res_ref = 0;
1255 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1256 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1257 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1258 res_ref = (uint64_t)res_var.inner & ~1;
1261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1262 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1263 CHECK(!val->result_ok);
1264 LDKDecodeError err_var = (*val->contents.err);
1265 uint64_t err_ref = 0;
1266 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1268 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1269 err_ref = (uint64_t)err_var.inner & ~1;
1272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1273 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
1274 CHECK(val->result_ok);
1275 LDKRouteParameters res_var = (*val->contents.result);
1276 uint64_t res_ref = 0;
1277 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1278 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1279 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1280 res_ref = (uint64_t)res_var.inner & ~1;
1283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1284 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
1285 CHECK(!val->result_ok);
1286 LDKDecodeError err_var = (*val->contents.err);
1287 uint64_t err_ref = 0;
1288 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1291 err_ref = (uint64_t)err_var.inner & ~1;
1294 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1295 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1296 for (size_t i = 0; i < ret.datalen; i++) {
1297 ret.data[i] = RouteHint_clone(&orig->data[i]);
1301 static jclass LDKCOption_u64Z_Some_class = NULL;
1302 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1303 static jclass LDKCOption_u64Z_None_class = NULL;
1304 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1306 LDKCOption_u64Z_Some_class =
1307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1308 CHECK(LDKCOption_u64Z_Some_class != NULL);
1309 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1310 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1311 LDKCOption_u64Z_None_class =
1312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1313 CHECK(LDKCOption_u64Z_None_class != NULL);
1314 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1315 CHECK(LDKCOption_u64Z_None_meth != NULL);
1317 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1318 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1320 case LDKCOption_u64Z_Some: {
1321 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1323 case LDKCOption_u64Z_None: {
1324 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1330 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
1331 CHECK(val->result_ok);
1332 LDKPayee res_var = (*val->contents.result);
1333 uint64_t res_ref = 0;
1334 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1335 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1336 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1337 res_ref = (uint64_t)res_var.inner & ~1;
1340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1341 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
1342 CHECK(!val->result_ok);
1343 LDKDecodeError err_var = (*val->contents.err);
1344 uint64_t err_ref = 0;
1345 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1346 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1347 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1348 err_ref = (uint64_t)err_var.inner & ~1;
1351 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1352 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1353 for (size_t i = 0; i < ret.datalen; i++) {
1354 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1359 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
1360 CHECK(val->result_ok);
1361 LDKRouteHint res_var = (*val->contents.result);
1362 uint64_t res_ref = 0;
1363 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1364 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1365 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1366 res_ref = (uint64_t)res_var.inner & ~1;
1369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1370 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
1371 CHECK(!val->result_ok);
1372 LDKDecodeError err_var = (*val->contents.err);
1373 uint64_t err_ref = 0;
1374 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1375 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1376 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1377 err_ref = (uint64_t)err_var.inner & ~1;
1380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1381 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
1382 CHECK(val->result_ok);
1383 LDKRouteHintHop res_var = (*val->contents.result);
1384 uint64_t res_ref = 0;
1385 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1386 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1387 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1388 res_ref = (uint64_t)res_var.inner & ~1;
1391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1392 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
1393 CHECK(!val->result_ok);
1394 LDKDecodeError err_var = (*val->contents.err);
1395 uint64_t err_ref = 0;
1396 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1397 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1398 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1399 err_ref = (uint64_t)err_var.inner & ~1;
1402 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1403 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1404 for (size_t i = 0; i < ret.datalen; i++) {
1405 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1410 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1411 CHECK(val->result_ok);
1412 LDKRoute res_var = (*val->contents.result);
1413 uint64_t res_ref = 0;
1414 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1415 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1416 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1417 res_ref = (uint64_t)res_var.inner & ~1;
1420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1421 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1422 CHECK(!val->result_ok);
1423 LDKLightningError err_var = (*val->contents.err);
1424 uint64_t err_ref = 0;
1425 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1426 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1427 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1428 err_ref = (uint64_t)err_var.inner & ~1;
1431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1432 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1433 CHECK(val->result_ok);
1434 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1435 return (uint64_t)res_ref;
1437 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1438 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1439 CHECK(!val->result_ok);
1440 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1443 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
1447 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1448 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1452 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
1456 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1457 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1458 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1459 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1460 Transaction_free(ret_var);
1464 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1465 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1466 for (size_t i = 0; i < ret.datalen; i++) {
1467 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1471 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1472 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1473 for (size_t i = 0; i < ret.datalen; i++) {
1474 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1479 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1480 CHECK(val->result_ok);
1481 return *val->contents.result;
1483 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1484 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1485 CHECK(!val->result_ok);
1486 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1489 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1490 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1491 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1492 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1493 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1494 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1495 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1496 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1498 LDKMonitorEvent_HTLCEvent_class =
1499 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1500 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1501 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1502 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1503 LDKMonitorEvent_CommitmentTxConfirmed_class =
1504 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1505 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1506 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1507 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1508 LDKMonitorEvent_UpdateCompleted_class =
1509 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1510 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1511 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1512 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1513 LDKMonitorEvent_UpdateFailed_class =
1514 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1515 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1516 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1517 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1519 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1520 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1522 case LDKMonitorEvent_HTLCEvent: {
1523 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1524 uint64_t htlc_event_ref = 0;
1525 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1526 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1527 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1528 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1529 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1531 case LDKMonitorEvent_CommitmentTxConfirmed: {
1532 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1533 uint64_t commitment_tx_confirmed_ref = 0;
1534 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1535 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1536 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1537 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1538 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1540 case LDKMonitorEvent_UpdateCompleted: {
1541 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1542 uint64_t funding_txo_ref = 0;
1543 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1544 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1545 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1546 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1547 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
1549 case LDKMonitorEvent_UpdateFailed: {
1550 LDKOutPoint update_failed_var = obj->update_failed;
1551 uint64_t update_failed_ref = 0;
1552 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1553 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1554 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1555 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1556 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
1561 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1562 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1563 for (size_t i = 0; i < ret.datalen; i++) {
1564 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1568 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1569 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1570 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1571 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1573 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1574 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
1575 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1576 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1577 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1578 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1579 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
1580 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1581 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1582 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1584 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1585 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1587 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1588 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1589 *some_conv = obj->some;
1590 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1591 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uint64_t)some_conv));
1593 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1594 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1599 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1600 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1601 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1602 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1603 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1604 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1605 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1606 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1607 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1608 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1609 static jclass LDKClosureReason_ProcessingError_class = NULL;
1610 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1611 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1612 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1613 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1614 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1616 LDKClosureReason_CounterpartyForceClosed_class =
1617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1618 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1619 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1620 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1621 LDKClosureReason_HolderForceClosed_class =
1622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
1623 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
1624 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
1625 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
1626 LDKClosureReason_CooperativeClosure_class =
1627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
1628 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
1629 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
1630 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
1631 LDKClosureReason_CommitmentTxConfirmed_class =
1632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
1633 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
1634 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
1635 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
1636 LDKClosureReason_FundingTimedOut_class =
1637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
1638 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
1639 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
1640 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
1641 LDKClosureReason_ProcessingError_class =
1642 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
1643 CHECK(LDKClosureReason_ProcessingError_class != NULL);
1644 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
1645 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
1646 LDKClosureReason_DisconnectedPeer_class =
1647 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
1648 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
1649 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
1650 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
1651 LDKClosureReason_OutdatedChannelManager_class =
1652 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
1653 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
1654 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
1655 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
1657 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1658 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1660 case LDKClosureReason_CounterpartyForceClosed: {
1661 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1662 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
1663 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
1665 case LDKClosureReason_HolderForceClosed: {
1666 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
1668 case LDKClosureReason_CooperativeClosure: {
1669 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
1671 case LDKClosureReason_CommitmentTxConfirmed: {
1672 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
1674 case LDKClosureReason_FundingTimedOut: {
1675 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
1677 case LDKClosureReason_ProcessingError: {
1678 LDKStr err_str = obj->processing_error.err;
1679 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1680 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
1682 case LDKClosureReason_DisconnectedPeer: {
1683 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
1685 case LDKClosureReason_OutdatedChannelManager: {
1686 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
1691 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
1692 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
1693 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
1694 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
1695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
1696 LDKCOption_ClosureReasonZ_Some_class =
1697 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
1698 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
1699 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
1700 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
1701 LDKCOption_ClosureReasonZ_None_class =
1702 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
1703 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
1704 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
1705 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
1707 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1708 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1710 case LDKCOption_ClosureReasonZ_Some: {
1711 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1712 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
1714 case LDKCOption_ClosureReasonZ_None: {
1715 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
1720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1721 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1722 CHECK(val->result_ok);
1723 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1727 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1728 CHECK(!val->result_ok);
1729 LDKDecodeError err_var = (*val->contents.err);
1730 uint64_t err_ref = 0;
1731 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1732 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1733 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1734 err_ref = (uint64_t)err_var.inner & ~1;
1737 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1738 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1739 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1740 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1741 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1742 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1744 LDKNetworkUpdate_ChannelUpdateMessage_class =
1745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
1746 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1747 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1748 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1749 LDKNetworkUpdate_ChannelClosed_class =
1750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
1751 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1752 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1753 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1754 LDKNetworkUpdate_NodeFailure_class =
1755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
1756 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1757 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1758 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1761 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1763 case LDKNetworkUpdate_ChannelUpdateMessage: {
1764 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1765 uint64_t msg_ref = 0;
1766 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1767 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1768 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1769 msg_ref = (uint64_t)msg_var.inner & ~1;
1770 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1772 case LDKNetworkUpdate_ChannelClosed: {
1773 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1775 case LDKNetworkUpdate_NodeFailure: {
1776 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1777 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1778 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1783 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1784 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1785 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1786 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1788 LDKCOption_NetworkUpdateZ_Some_class =
1789 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
1790 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1791 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1792 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1793 LDKCOption_NetworkUpdateZ_None_class =
1794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
1795 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1796 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1797 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1799 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1800 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1802 case LDKCOption_NetworkUpdateZ_Some: {
1803 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1804 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1806 case LDKCOption_NetworkUpdateZ_None: {
1807 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1812 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1813 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1814 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1815 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1816 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1817 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1819 LDKSpendableOutputDescriptor_StaticOutput_class =
1820 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
1821 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1822 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1823 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1824 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1825 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
1826 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1827 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1828 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1829 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1830 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
1831 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1832 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1833 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1835 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1836 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1838 case LDKSpendableOutputDescriptor_StaticOutput: {
1839 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1840 uint64_t outpoint_ref = 0;
1841 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1842 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1843 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1844 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1845 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1846 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1848 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1849 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1850 uint64_t delayed_payment_output_ref = 0;
1851 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1854 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1855 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1857 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1858 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1859 uint64_t static_payment_output_ref = 0;
1860 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1861 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1862 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1863 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1864 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1869 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1870 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1871 for (size_t i = 0; i < ret.datalen; i++) {
1872 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1876 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1877 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1878 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1879 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1881 LDKPaymentPurpose_InvoicePayment_class =
1882 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1883 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1884 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1885 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1886 LDKPaymentPurpose_SpontaneousPayment_class =
1887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1888 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1889 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1890 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1892 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1893 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1895 case LDKPaymentPurpose_InvoicePayment: {
1896 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1897 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1898 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1899 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1900 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1902 case LDKPaymentPurpose_SpontaneousPayment: {
1903 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1904 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1905 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1910 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1911 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1912 static jclass LDKEvent_PaymentReceived_class = NULL;
1913 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1914 static jclass LDKEvent_PaymentSent_class = NULL;
1915 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1916 static jclass LDKEvent_PaymentPathFailed_class = NULL;
1917 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
1918 static jclass LDKEvent_PaymentFailed_class = NULL;
1919 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1920 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1921 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1922 static jclass LDKEvent_SpendableOutputs_class = NULL;
1923 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1924 static jclass LDKEvent_PaymentForwarded_class = NULL;
1925 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
1926 static jclass LDKEvent_ChannelClosed_class = NULL;
1927 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
1928 static jclass LDKEvent_DiscardFunding_class = NULL;
1929 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
1930 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
1931 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
1932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1933 LDKEvent_FundingGenerationReady_class =
1934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
1935 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1936 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1937 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1938 LDKEvent_PaymentReceived_class =
1939 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
1940 CHECK(LDKEvent_PaymentReceived_class != NULL);
1941 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
1942 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1943 LDKEvent_PaymentSent_class =
1944 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
1945 CHECK(LDKEvent_PaymentSent_class != NULL);
1946 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
1947 CHECK(LDKEvent_PaymentSent_meth != NULL);
1948 LDKEvent_PaymentPathFailed_class =
1949 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
1950 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
1951 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
1952 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
1953 LDKEvent_PaymentFailed_class =
1954 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
1955 CHECK(LDKEvent_PaymentFailed_class != NULL);
1956 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
1957 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1958 LDKEvent_PendingHTLCsForwardable_class =
1959 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
1960 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1961 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1962 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1963 LDKEvent_SpendableOutputs_class =
1964 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
1965 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1966 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1967 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1968 LDKEvent_PaymentForwarded_class =
1969 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
1970 CHECK(LDKEvent_PaymentForwarded_class != NULL);
1971 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
1972 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
1973 LDKEvent_ChannelClosed_class =
1974 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
1975 CHECK(LDKEvent_ChannelClosed_class != NULL);
1976 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
1977 CHECK(LDKEvent_ChannelClosed_meth != NULL);
1978 LDKEvent_DiscardFunding_class =
1979 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
1980 CHECK(LDKEvent_DiscardFunding_class != NULL);
1981 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
1982 CHECK(LDKEvent_DiscardFunding_meth != NULL);
1983 LDKEvent_PaymentPathSuccessful_class =
1984 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
1985 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
1986 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
1987 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
1989 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1990 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1992 case LDKEvent_FundingGenerationReady: {
1993 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1994 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1995 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1996 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1997 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1998 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);
2000 case LDKEvent_PaymentReceived: {
2001 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2002 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2003 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
2004 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
2006 case LDKEvent_PaymentSent: {
2007 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2008 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2009 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2010 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2011 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2012 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2013 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
2014 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2016 case LDKEvent_PaymentPathFailed: {
2017 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2018 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2019 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2020 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2021 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
2022 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2023 int64_tArray path_arr = NULL;
2024 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2025 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2026 for (size_t k = 0; k < path_var.datalen; k++) {
2027 LDKRouteHop path_conv_10_var = path_var.data[k];
2028 uint64_t path_conv_10_ref = 0;
2029 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2030 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2031 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2032 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
2033 path_arr_ptr[k] = path_conv_10_ref;
2035 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2036 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
2037 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2038 uint64_t retry_ref = 0;
2039 if ((uint64_t)retry_var.inner > 4096) {
2040 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2041 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2042 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2043 retry_ref = (uint64_t)retry_var.inner & ~1;
2045 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref);
2047 case LDKEvent_PaymentFailed: {
2048 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2049 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2050 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2051 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2052 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2054 case LDKEvent_PendingHTLCsForwardable: {
2055 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
2057 case LDKEvent_SpendableOutputs: {
2058 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2059 int64_tArray outputs_arr = NULL;
2060 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2061 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2062 for (size_t b = 0; b < outputs_var.datalen; b++) {
2063 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
2064 outputs_arr_ptr[b] = outputs_conv_27_ref;
2066 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2067 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2069 case LDKEvent_PaymentForwarded: {
2070 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2071 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
2073 case LDKEvent_ChannelClosed: {
2074 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2075 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2076 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
2077 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
2079 case LDKEvent_DiscardFunding: {
2080 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2081 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2082 LDKTransaction transaction_var = obj->discard_funding.transaction;
2083 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2084 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2085 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2087 case LDKEvent_PaymentPathSuccessful: {
2088 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2089 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2090 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2091 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2092 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2093 int64_tArray path_arr = NULL;
2094 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2095 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2096 for (size_t k = 0; k < path_var.datalen; k++) {
2097 LDKRouteHop path_conv_10_var = path_var.data[k];
2098 uint64_t path_conv_10_ref = 0;
2099 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2100 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2101 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2102 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
2103 path_arr_ptr[k] = path_conv_10_ref;
2105 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2106 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2111 static jclass LDKCOption_EventZ_Some_class = NULL;
2112 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2113 static jclass LDKCOption_EventZ_None_class = NULL;
2114 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2116 LDKCOption_EventZ_Some_class =
2117 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2118 CHECK(LDKCOption_EventZ_Some_class != NULL);
2119 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2120 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2121 LDKCOption_EventZ_None_class =
2122 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2123 CHECK(LDKCOption_EventZ_None_class != NULL);
2124 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2125 CHECK(LDKCOption_EventZ_None_meth != NULL);
2127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2128 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2130 case LDKCOption_EventZ_Some: {
2131 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
2132 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2134 case LDKCOption_EventZ_None: {
2135 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2141 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
2142 CHECK(val->result_ok);
2143 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2147 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
2148 CHECK(!val->result_ok);
2149 LDKDecodeError err_var = (*val->contents.err);
2150 uint64_t err_ref = 0;
2151 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2152 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2153 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2154 err_ref = (uint64_t)err_var.inner & ~1;
2157 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2158 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2159 static jclass LDKErrorAction_IgnoreError_class = NULL;
2160 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2161 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2162 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2163 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2164 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2165 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2166 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2168 LDKErrorAction_DisconnectPeer_class =
2169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2170 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2171 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2172 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2173 LDKErrorAction_IgnoreError_class =
2174 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2175 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2176 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2177 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2178 LDKErrorAction_IgnoreAndLog_class =
2179 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2180 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2181 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2182 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2183 LDKErrorAction_IgnoreDuplicateGossip_class =
2184 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2185 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2186 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2187 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2188 LDKErrorAction_SendErrorMessage_class =
2189 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2190 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2191 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2192 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2194 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2195 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2197 case LDKErrorAction_DisconnectPeer: {
2198 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2199 uint64_t msg_ref = 0;
2200 if ((uint64_t)msg_var.inner > 4096) {
2201 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2202 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2203 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2204 msg_ref = (uint64_t)msg_var.inner & ~1;
2206 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2208 case LDKErrorAction_IgnoreError: {
2209 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2211 case LDKErrorAction_IgnoreAndLog: {
2212 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2213 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2215 case LDKErrorAction_IgnoreDuplicateGossip: {
2216 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2218 case LDKErrorAction_SendErrorMessage: {
2219 LDKErrorMessage msg_var = obj->send_error_message.msg;
2220 uint64_t msg_ref = 0;
2221 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2222 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2223 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2224 msg_ref = (uint64_t)msg_var.inner & ~1;
2225 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2230 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2231 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2232 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2233 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2234 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2235 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2236 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2237 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2238 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2239 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2240 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2241 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2242 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2243 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2244 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2245 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2246 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2247 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2248 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2249 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2250 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2251 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2252 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2253 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2254 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2255 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2256 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2257 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2258 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2259 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2260 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2261 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2262 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2263 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2264 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2265 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2266 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2267 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2269 LDKMessageSendEvent_SendAcceptChannel_class =
2270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2271 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2272 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2273 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2274 LDKMessageSendEvent_SendOpenChannel_class =
2275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2276 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2277 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2278 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2279 LDKMessageSendEvent_SendFundingCreated_class =
2280 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2281 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2282 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2283 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2284 LDKMessageSendEvent_SendFundingSigned_class =
2285 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2286 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2287 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2288 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2289 LDKMessageSendEvent_SendFundingLocked_class =
2290 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2291 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2292 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2293 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2294 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2295 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2296 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2297 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2298 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2299 LDKMessageSendEvent_UpdateHTLCs_class =
2300 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2301 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2302 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2303 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2304 LDKMessageSendEvent_SendRevokeAndACK_class =
2305 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2306 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2307 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2308 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2309 LDKMessageSendEvent_SendClosingSigned_class =
2310 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2311 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2312 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2313 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2314 LDKMessageSendEvent_SendShutdown_class =
2315 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2316 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2317 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2318 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2319 LDKMessageSendEvent_SendChannelReestablish_class =
2320 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2321 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2322 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2323 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2324 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2325 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2326 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2327 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2328 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2329 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2330 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2331 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2332 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2333 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2334 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2335 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2336 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2337 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2338 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2339 LDKMessageSendEvent_SendChannelUpdate_class =
2340 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2341 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2342 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2343 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2344 LDKMessageSendEvent_HandleError_class =
2345 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2346 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2347 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2348 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2349 LDKMessageSendEvent_SendChannelRangeQuery_class =
2350 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2351 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2352 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2353 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2354 LDKMessageSendEvent_SendShortIdsQuery_class =
2355 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2356 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2357 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2358 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2359 LDKMessageSendEvent_SendReplyChannelRange_class =
2360 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2361 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2362 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2363 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2365 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2366 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2368 case LDKMessageSendEvent_SendAcceptChannel: {
2369 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2370 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2371 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2372 uint64_t msg_ref = 0;
2373 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2374 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2375 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2376 msg_ref = (uint64_t)msg_var.inner & ~1;
2377 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2379 case LDKMessageSendEvent_SendOpenChannel: {
2380 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2381 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2382 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2383 uint64_t msg_ref = 0;
2384 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2385 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2386 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2387 msg_ref = (uint64_t)msg_var.inner & ~1;
2388 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2390 case LDKMessageSendEvent_SendFundingCreated: {
2391 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2392 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2393 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2394 uint64_t msg_ref = 0;
2395 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2396 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2397 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2398 msg_ref = (uint64_t)msg_var.inner & ~1;
2399 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2401 case LDKMessageSendEvent_SendFundingSigned: {
2402 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2403 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2404 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2405 uint64_t msg_ref = 0;
2406 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2407 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2408 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2409 msg_ref = (uint64_t)msg_var.inner & ~1;
2410 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2412 case LDKMessageSendEvent_SendFundingLocked: {
2413 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2414 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2415 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2416 uint64_t msg_ref = 0;
2417 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2418 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2419 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2420 msg_ref = (uint64_t)msg_var.inner & ~1;
2421 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2423 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2424 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2425 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2426 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2427 uint64_t msg_ref = 0;
2428 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2429 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2430 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2431 msg_ref = (uint64_t)msg_var.inner & ~1;
2432 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2434 case LDKMessageSendEvent_UpdateHTLCs: {
2435 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2436 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2437 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2438 uint64_t updates_ref = 0;
2439 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2440 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2441 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2442 updates_ref = (uint64_t)updates_var.inner & ~1;
2443 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2445 case LDKMessageSendEvent_SendRevokeAndACK: {
2446 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2447 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2448 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2449 uint64_t msg_ref = 0;
2450 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2451 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2452 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2453 msg_ref = (uint64_t)msg_var.inner & ~1;
2454 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2456 case LDKMessageSendEvent_SendClosingSigned: {
2457 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2458 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2459 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2460 uint64_t msg_ref = 0;
2461 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2462 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2463 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2464 msg_ref = (uint64_t)msg_var.inner & ~1;
2465 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2467 case LDKMessageSendEvent_SendShutdown: {
2468 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2469 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2470 LDKShutdown msg_var = obj->send_shutdown.msg;
2471 uint64_t msg_ref = 0;
2472 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2473 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2474 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2475 msg_ref = (uint64_t)msg_var.inner & ~1;
2476 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2478 case LDKMessageSendEvent_SendChannelReestablish: {
2479 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2480 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2481 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2482 uint64_t msg_ref = 0;
2483 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2484 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2485 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2486 msg_ref = (uint64_t)msg_var.inner & ~1;
2487 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2489 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2490 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2491 uint64_t msg_ref = 0;
2492 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2493 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2495 msg_ref = (uint64_t)msg_var.inner & ~1;
2496 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2497 uint64_t update_msg_ref = 0;
2498 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2499 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2500 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2501 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
2502 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2504 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2505 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2506 uint64_t msg_ref = 0;
2507 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2508 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2509 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2510 msg_ref = (uint64_t)msg_var.inner & ~1;
2511 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2513 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2514 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2515 uint64_t msg_ref = 0;
2516 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2517 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2518 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2519 msg_ref = (uint64_t)msg_var.inner & ~1;
2520 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2522 case LDKMessageSendEvent_SendChannelUpdate: {
2523 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2524 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2525 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2526 uint64_t msg_ref = 0;
2527 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2528 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2530 msg_ref = (uint64_t)msg_var.inner & ~1;
2531 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2533 case LDKMessageSendEvent_HandleError: {
2534 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2535 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2536 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
2537 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2539 case LDKMessageSendEvent_SendChannelRangeQuery: {
2540 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2541 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2542 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2543 uint64_t msg_ref = 0;
2544 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2545 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2546 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2547 msg_ref = (uint64_t)msg_var.inner & ~1;
2548 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2550 case LDKMessageSendEvent_SendShortIdsQuery: {
2551 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2552 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
2553 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2554 uint64_t msg_ref = 0;
2555 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2556 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2557 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2558 msg_ref = (uint64_t)msg_var.inner & ~1;
2559 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
2561 case LDKMessageSendEvent_SendReplyChannelRange: {
2562 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2563 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
2564 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2565 uint64_t msg_ref = 0;
2566 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2567 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2568 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2569 msg_ref = (uint64_t)msg_var.inner & ~1;
2570 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
2575 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2576 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2577 for (size_t i = 0; i < ret.datalen; i++) {
2578 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2583 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
2584 CHECK(val->result_ok);
2585 LDKScoringParameters res_var = (*val->contents.result);
2586 uint64_t res_ref = 0;
2587 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2588 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2589 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2590 res_ref = (uint64_t)res_var.inner & ~1;
2593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2594 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
2595 CHECK(!val->result_ok);
2596 LDKDecodeError err_var = (*val->contents.err);
2597 uint64_t err_ref = 0;
2598 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2599 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2600 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2601 err_ref = (uint64_t)err_var.inner & ~1;
2604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2605 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
2606 CHECK(val->result_ok);
2607 LDKScorer res_var = (*val->contents.result);
2608 uint64_t res_ref = 0;
2609 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2610 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2611 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2612 res_ref = (uint64_t)res_var.inner & ~1;
2615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2616 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
2617 CHECK(!val->result_ok);
2618 LDKDecodeError err_var = (*val->contents.err);
2619 uint64_t err_ref = 0;
2620 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2621 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2622 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2623 err_ref = (uint64_t)err_var.inner & ~1;
2626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2627 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2628 CHECK(val->result_ok);
2629 LDKInitFeatures res_var = (*val->contents.result);
2630 uint64_t res_ref = 0;
2631 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2632 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2633 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2634 res_ref = (uint64_t)res_var.inner & ~1;
2637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2638 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2639 CHECK(!val->result_ok);
2640 LDKDecodeError err_var = (*val->contents.err);
2641 uint64_t err_ref = 0;
2642 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2643 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2644 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2645 err_ref = (uint64_t)err_var.inner & ~1;
2648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2649 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2650 CHECK(val->result_ok);
2651 LDKChannelFeatures res_var = (*val->contents.result);
2652 uint64_t res_ref = 0;
2653 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2654 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2655 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2656 res_ref = (uint64_t)res_var.inner & ~1;
2659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2660 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2661 CHECK(!val->result_ok);
2662 LDKDecodeError err_var = (*val->contents.err);
2663 uint64_t err_ref = 0;
2664 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2665 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2666 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2667 err_ref = (uint64_t)err_var.inner & ~1;
2670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2671 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2672 CHECK(val->result_ok);
2673 LDKNodeFeatures res_var = (*val->contents.result);
2674 uint64_t res_ref = 0;
2675 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2676 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2677 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2678 res_ref = (uint64_t)res_var.inner & ~1;
2681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2682 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2683 CHECK(!val->result_ok);
2684 LDKDecodeError err_var = (*val->contents.err);
2685 uint64_t err_ref = 0;
2686 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2687 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2688 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2689 err_ref = (uint64_t)err_var.inner & ~1;
2692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2693 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2694 CHECK(val->result_ok);
2695 LDKInvoiceFeatures res_var = (*val->contents.result);
2696 uint64_t res_ref = 0;
2697 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2698 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2699 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2700 res_ref = (uint64_t)res_var.inner & ~1;
2703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2704 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2705 CHECK(!val->result_ok);
2706 LDKDecodeError err_var = (*val->contents.err);
2707 uint64_t err_ref = 0;
2708 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2709 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2710 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2711 err_ref = (uint64_t)err_var.inner & ~1;
2714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2715 LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
2716 CHECK(val->result_ok);
2717 LDKChannelTypeFeatures res_var = (*val->contents.result);
2718 uint64_t res_ref = 0;
2719 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2720 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2721 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2722 res_ref = (uint64_t)res_var.inner & ~1;
2725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2726 LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
2727 CHECK(!val->result_ok);
2728 LDKDecodeError err_var = (*val->contents.err);
2729 uint64_t err_ref = 0;
2730 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2731 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2732 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2733 err_ref = (uint64_t)err_var.inner & ~1;
2736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2737 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2738 CHECK(val->result_ok);
2739 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2740 uint64_t res_ref = 0;
2741 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2742 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2743 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2744 res_ref = (uint64_t)res_var.inner & ~1;
2747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2748 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2749 CHECK(!val->result_ok);
2750 LDKDecodeError err_var = (*val->contents.err);
2751 uint64_t err_ref = 0;
2752 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2753 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2754 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2755 err_ref = (uint64_t)err_var.inner & ~1;
2758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2759 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2760 CHECK(val->result_ok);
2761 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2762 uint64_t res_ref = 0;
2763 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2764 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2765 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2766 res_ref = (uint64_t)res_var.inner & ~1;
2769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2770 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2771 CHECK(!val->result_ok);
2772 LDKDecodeError err_var = (*val->contents.err);
2773 uint64_t err_ref = 0;
2774 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2775 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2776 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2777 err_ref = (uint64_t)err_var.inner & ~1;
2780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2781 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2782 CHECK(val->result_ok);
2783 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2787 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2788 CHECK(!val->result_ok);
2789 LDKDecodeError err_var = (*val->contents.err);
2790 uint64_t err_ref = 0;
2791 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2792 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2793 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2794 err_ref = (uint64_t)err_var.inner & ~1;
2797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2798 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2799 CHECK(val->result_ok);
2800 return *val->contents.result;
2802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2803 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2804 CHECK(!val->result_ok);
2805 return *val->contents.err;
2807 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
2811 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2812 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form);
2817 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2820 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
2821 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2822 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
2823 jobjectArray ret_arr = NULL;
2824 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2826 for (size_t i = 0; i < ret_var.datalen; i++) {
2827 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2828 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2829 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2837 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2838 CHECK(val->result_ok);
2839 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2840 *res_conv = (*val->contents.result);
2841 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
2842 return ((uint64_t)res_conv);
2844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2845 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2846 CHECK(!val->result_ok);
2847 return *val->contents.err;
2849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2850 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2851 CHECK(val->result_ok);
2852 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2853 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2857 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2858 CHECK(!val->result_ok);
2859 return *val->contents.err;
2861 typedef struct LDKBaseSign_JCalls {
2862 atomic_size_t refcnt;
2865 jmethodID get_per_commitment_point_meth;
2866 jmethodID release_commitment_secret_meth;
2867 jmethodID validate_holder_commitment_meth;
2868 jmethodID channel_keys_id_meth;
2869 jmethodID sign_counterparty_commitment_meth;
2870 jmethodID validate_counterparty_revocation_meth;
2871 jmethodID sign_holder_commitment_and_htlcs_meth;
2872 jmethodID sign_justice_revoked_output_meth;
2873 jmethodID sign_justice_revoked_htlc_meth;
2874 jmethodID sign_counterparty_htlc_transaction_meth;
2875 jmethodID sign_closing_transaction_meth;
2876 jmethodID sign_channel_announcement_meth;
2877 jmethodID ready_channel_meth;
2878 } LDKBaseSign_JCalls;
2879 static void LDKBaseSign_JCalls_free(void* this_arg) {
2880 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2881 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2883 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2884 if (get_jenv_res == JNI_EDETACHED) {
2885 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2887 DO_ASSERT(get_jenv_res == JNI_OK);
2889 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2890 if (get_jenv_res == JNI_EDETACHED) {
2891 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2896 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2897 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2899 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2900 if (get_jenv_res == JNI_EDETACHED) {
2901 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2903 DO_ASSERT(get_jenv_res == JNI_OK);
2905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2907 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2908 if (UNLIKELY((*env)->ExceptionCheck(env))) {
2909 (*env)->ExceptionDescribe(env);
2910 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2912 LDKPublicKey ret_ref;
2913 CHECK((*env)->GetArrayLength(env, ret) == 33);
2914 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2915 if (get_jenv_res == JNI_EDETACHED) {
2916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2920 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2921 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2923 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2924 if (get_jenv_res == JNI_EDETACHED) {
2925 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2927 DO_ASSERT(get_jenv_res == JNI_OK);
2929 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2931 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2932 if (UNLIKELY((*env)->ExceptionCheck(env))) {
2933 (*env)->ExceptionDescribe(env);
2934 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2936 LDKThirtyTwoBytes ret_ref;
2937 CHECK((*env)->GetArrayLength(env, ret) == 32);
2938 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2939 if (get_jenv_res == JNI_EDETACHED) {
2940 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2944 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2945 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2948 if (get_jenv_res == JNI_EDETACHED) {
2949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2951 DO_ASSERT(get_jenv_res == JNI_OK);
2953 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2954 uint64_t holder_tx_ref = 0;
2955 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2956 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2957 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2958 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2959 holder_tx_ref = (uint64_t)holder_tx_var.inner;
2960 if (holder_tx_var.is_owned) {
2963 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2965 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2966 if (UNLIKELY((*env)->ExceptionCheck(env))) {
2967 (*env)->ExceptionDescribe(env);
2968 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2970 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2971 CHECK_ACCESS(ret_ptr);
2972 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2974 if (get_jenv_res == JNI_EDETACHED) {
2975 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2979 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2980 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2983 if (get_jenv_res == JNI_EDETACHED) {
2984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2986 DO_ASSERT(get_jenv_res == JNI_OK);
2988 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2990 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2991 if (UNLIKELY((*env)->ExceptionCheck(env))) {
2992 (*env)->ExceptionDescribe(env);
2993 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2995 LDKThirtyTwoBytes ret_ref;
2996 CHECK((*env)->GetArrayLength(env, ret) == 32);
2997 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2998 if (get_jenv_res == JNI_EDETACHED) {
2999 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3003 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
3004 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3006 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3007 if (get_jenv_res == JNI_EDETACHED) {
3008 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3010 DO_ASSERT(get_jenv_res == JNI_OK);
3012 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3013 uint64_t commitment_tx_ref = 0;
3014 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
3015 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3016 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3017 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3018 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
3019 if (commitment_tx_var.is_owned) {
3020 commitment_tx_ref |= 1;
3022 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3024 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
3025 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3026 (*env)->ExceptionDescribe(env);
3027 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3029 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3030 CHECK_ACCESS(ret_ptr);
3031 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3033 if (get_jenv_res == JNI_EDETACHED) {
3034 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3038 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3039 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3041 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3042 if (get_jenv_res == JNI_EDETACHED) {
3043 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3045 DO_ASSERT(get_jenv_res == JNI_OK);
3047 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3048 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3049 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3051 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
3052 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3053 (*env)->ExceptionDescribe(env);
3054 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3056 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3057 CHECK_ACCESS(ret_ptr);
3058 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3060 if (get_jenv_res == JNI_EDETACHED) {
3061 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3065 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3066 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3068 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3069 if (get_jenv_res == JNI_EDETACHED) {
3070 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3072 DO_ASSERT(get_jenv_res == JNI_OK);
3074 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3075 uint64_t commitment_tx_ref = 0;
3076 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
3077 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3078 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3079 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3080 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
3081 if (commitment_tx_var.is_owned) {
3082 commitment_tx_ref |= 1;
3084 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3086 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3087 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3088 (*env)->ExceptionDescribe(env);
3089 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3091 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3092 CHECK_ACCESS(ret_ptr);
3093 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3095 if (get_jenv_res == JNI_EDETACHED) {
3096 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3100 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]) {
3101 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3103 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3104 if (get_jenv_res == JNI_EDETACHED) {
3105 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3107 DO_ASSERT(get_jenv_res == JNI_OK);
3109 LDKTransaction justice_tx_var = justice_tx;
3110 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3111 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3112 Transaction_free(justice_tx_var);
3113 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3114 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3115 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3117 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
3118 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3119 (*env)->ExceptionDescribe(env);
3120 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
3122 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3123 CHECK_ACCESS(ret_ptr);
3124 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3126 if (get_jenv_res == JNI_EDETACHED) {
3127 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3131 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) {
3132 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3134 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3135 if (get_jenv_res == JNI_EDETACHED) {
3136 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3138 DO_ASSERT(get_jenv_res == JNI_OK);
3140 LDKTransaction justice_tx_var = justice_tx;
3141 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3142 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3143 Transaction_free(justice_tx_var);
3144 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3145 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3146 LDKHTLCOutputInCommitment htlc_var = *htlc;
3147 uint64_t htlc_ref = 0;
3148 htlc_var = HTLCOutputInCommitment_clone(htlc);
3149 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3150 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3151 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3152 htlc_ref = (uint64_t)htlc_var.inner;
3153 if (htlc_var.is_owned) {
3156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3158 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
3159 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3160 (*env)->ExceptionDescribe(env);
3161 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
3163 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3164 CHECK_ACCESS(ret_ptr);
3165 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3167 if (get_jenv_res == JNI_EDETACHED) {
3168 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3172 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) {
3173 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3175 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3176 if (get_jenv_res == JNI_EDETACHED) {
3177 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3179 DO_ASSERT(get_jenv_res == JNI_OK);
3181 LDKTransaction htlc_tx_var = htlc_tx;
3182 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3183 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3184 Transaction_free(htlc_tx_var);
3185 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3186 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3187 LDKHTLCOutputInCommitment htlc_var = *htlc;
3188 uint64_t htlc_ref = 0;
3189 htlc_var = HTLCOutputInCommitment_clone(htlc);
3190 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3193 htlc_ref = (uint64_t)htlc_var.inner;
3194 if (htlc_var.is_owned) {
3197 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3199 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
3200 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3201 (*env)->ExceptionDescribe(env);
3202 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
3204 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3205 CHECK_ACCESS(ret_ptr);
3206 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3208 if (get_jenv_res == JNI_EDETACHED) {
3209 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3213 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3214 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3216 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3217 if (get_jenv_res == JNI_EDETACHED) {
3218 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3220 DO_ASSERT(get_jenv_res == JNI_OK);
3222 LDKClosingTransaction closing_tx_var = *closing_tx;
3223 uint64_t closing_tx_ref = 0;
3224 closing_tx_var = ClosingTransaction_clone(closing_tx);
3225 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3226 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3227 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3228 closing_tx_ref = (uint64_t)closing_tx_var.inner;
3229 if (closing_tx_var.is_owned) {
3230 closing_tx_ref |= 1;
3232 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3234 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3235 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3236 (*env)->ExceptionDescribe(env);
3237 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
3239 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3240 CHECK_ACCESS(ret_ptr);
3241 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3243 if (get_jenv_res == JNI_EDETACHED) {
3244 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3248 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3249 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3251 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3252 if (get_jenv_res == JNI_EDETACHED) {
3253 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3255 DO_ASSERT(get_jenv_res == JNI_OK);
3257 LDKUnsignedChannelAnnouncement msg_var = *msg;
3258 uint64_t msg_ref = 0;
3259 msg_var = UnsignedChannelAnnouncement_clone(msg);
3260 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3261 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3262 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3263 msg_ref = (uint64_t)msg_var.inner;
3264 if (msg_var.is_owned) {
3267 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3269 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
3270 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3271 (*env)->ExceptionDescribe(env);
3272 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
3274 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3275 CHECK_ACCESS(ret_ptr);
3276 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3278 if (get_jenv_res == JNI_EDETACHED) {
3279 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3283 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3284 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3286 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3287 if (get_jenv_res == JNI_EDETACHED) {
3288 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3290 DO_ASSERT(get_jenv_res == JNI_OK);
3292 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3293 uint64_t channel_parameters_ref = 0;
3294 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
3295 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3296 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3297 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3298 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
3299 if (channel_parameters_var.is_owned) {
3300 channel_parameters_ref |= 1;
3302 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3304 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
3305 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3306 (*env)->ExceptionDescribe(env);
3307 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
3309 if (get_jenv_res == JNI_EDETACHED) {
3310 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3313 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3314 jclass c = (*env)->GetObjectClass(env, o);
3316 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3317 atomic_init(&calls->refcnt, 1);
3318 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3319 calls->o = (*env)->NewWeakGlobalRef(env, o);
3320 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
3321 CHECK(calls->get_per_commitment_point_meth != NULL);
3322 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
3323 CHECK(calls->release_commitment_secret_meth != NULL);
3324 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
3325 CHECK(calls->validate_holder_commitment_meth != NULL);
3326 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
3327 CHECK(calls->channel_keys_id_meth != NULL);
3328 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
3329 CHECK(calls->sign_counterparty_commitment_meth != NULL);
3330 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3331 CHECK(calls->validate_counterparty_revocation_meth != NULL);
3332 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
3333 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
3334 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3335 CHECK(calls->sign_justice_revoked_output_meth != NULL);
3336 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3337 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3338 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3339 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3340 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3341 CHECK(calls->sign_closing_transaction_meth != NULL);
3342 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
3343 CHECK(calls->sign_channel_announcement_meth != NULL);
3344 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
3345 CHECK(calls->ready_channel_meth != NULL);
3347 LDKChannelPublicKeys pubkeys_conv;
3348 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3349 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3350 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3353 .this_arg = (void*) calls,
3354 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3355 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3356 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3357 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3358 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3359 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3360 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3361 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3362 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3363 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3364 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3365 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3366 .ready_channel = ready_channel_LDKBaseSign_jcall,
3367 .free = LDKBaseSign_JCalls_free,
3368 .pubkeys = pubkeys_conv,
3369 .set_pubkeys = NULL,
3373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3374 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3375 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
3376 return (uint64_t)res_ptr;
3378 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) {
3379 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3380 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3381 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3382 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3383 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3388 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3390 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3391 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3392 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
3397 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3398 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3399 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3400 LDKHolderCommitmentTransaction holder_tx_conv;
3401 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3402 holder_tx_conv.is_owned = false;
3403 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3404 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3405 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
3406 return (uint64_t)ret_conv;
3409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3410 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3411 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3412 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3413 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3414 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3418 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) {
3419 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3420 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3421 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3422 LDKCommitmentTransaction commitment_tx_conv;
3423 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3424 commitment_tx_conv.is_owned = false;
3425 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3426 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3427 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3428 return (uint64_t)ret_conv;
3431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3432 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3433 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3434 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3435 unsigned char secret_arr[32];
3436 CHECK((*env)->GetArrayLength(env, secret) == 32);
3437 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3438 unsigned char (*secret_ref)[32] = &secret_arr;
3439 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3440 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3441 return (uint64_t)ret_conv;
3444 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) {
3445 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3446 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3447 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3448 LDKHolderCommitmentTransaction commitment_tx_conv;
3449 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3450 commitment_tx_conv.is_owned = false;
3451 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3452 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3453 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3454 return (uint64_t)ret_conv;
3457 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) {
3458 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3459 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3460 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3461 LDKTransaction justice_tx_ref;
3462 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3463 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3464 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3465 justice_tx_ref.data_is_owned = true;
3466 unsigned char per_commitment_key_arr[32];
3467 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3468 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3469 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3470 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3471 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3472 return (uint64_t)ret_conv;
3475 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) {
3476 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3477 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3478 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3479 LDKTransaction justice_tx_ref;
3480 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3481 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3482 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3483 justice_tx_ref.data_is_owned = true;
3484 unsigned char per_commitment_key_arr[32];
3485 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3486 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3487 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3488 LDKHTLCOutputInCommitment htlc_conv;
3489 htlc_conv.inner = (void*)(htlc & (~1));
3490 htlc_conv.is_owned = false;
3491 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3492 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3493 *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);
3494 return (uint64_t)ret_conv;
3497 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) {
3498 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3499 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3500 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3501 LDKTransaction htlc_tx_ref;
3502 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3503 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3504 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3505 htlc_tx_ref.data_is_owned = true;
3506 LDKPublicKey per_commitment_point_ref;
3507 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3508 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3509 LDKHTLCOutputInCommitment htlc_conv;
3510 htlc_conv.inner = (void*)(htlc & (~1));
3511 htlc_conv.is_owned = false;
3512 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3513 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3514 *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);
3515 return (uint64_t)ret_conv;
3518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
3519 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3520 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3521 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3522 LDKClosingTransaction closing_tx_conv;
3523 closing_tx_conv.inner = (void*)(closing_tx & (~1));
3524 closing_tx_conv.is_owned = false;
3525 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3526 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3527 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3528 return (uint64_t)ret_conv;
3531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
3532 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3534 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3535 LDKUnsignedChannelAnnouncement msg_conv;
3536 msg_conv.inner = (void*)(msg & (~1));
3537 msg_conv.is_owned = false;
3538 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3539 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3540 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3541 return (uint64_t)ret_conv;
3544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
3545 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3546 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3547 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3548 LDKChannelTransactionParameters channel_parameters_conv;
3549 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
3550 channel_parameters_conv.is_owned = false;
3551 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3552 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
3555 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
3556 if (this_arg->set_pubkeys != NULL)
3557 this_arg->set_pubkeys(this_arg);
3558 return this_arg->pubkeys;
3560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
3561 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3562 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3563 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3564 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
3565 uint64_t ret_ref = 0;
3566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3569 ret_ref = (uint64_t)ret_var.inner;
3570 if (ret_var.is_owned) {
3576 typedef struct LDKSign_JCalls {
3577 atomic_size_t refcnt;
3580 LDKBaseSign_JCalls* BaseSign;
3581 jmethodID write_meth;
3583 static void LDKSign_JCalls_free(void* this_arg) {
3584 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3585 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3587 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3588 if (get_jenv_res == JNI_EDETACHED) {
3589 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3591 DO_ASSERT(get_jenv_res == JNI_OK);
3593 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3594 if (get_jenv_res == JNI_EDETACHED) {
3595 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3600 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
3601 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3603 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3604 if (get_jenv_res == JNI_EDETACHED) {
3605 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3607 DO_ASSERT(get_jenv_res == JNI_OK);
3609 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3611 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3612 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3613 (*env)->ExceptionDescribe(env);
3614 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
3616 LDKCVec_u8Z ret_ref;
3617 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3618 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3619 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3620 if (get_jenv_res == JNI_EDETACHED) {
3621 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3625 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
3626 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
3627 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3628 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
3630 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
3631 jclass c = (*env)->GetObjectClass(env, o);
3633 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
3634 atomic_init(&calls->refcnt, 1);
3635 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3636 calls->o = (*env)->NewWeakGlobalRef(env, o);
3637 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3638 CHECK(calls->write_meth != NULL);
3640 LDKChannelPublicKeys pubkeys_conv;
3641 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3642 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3643 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3646 .this_arg = (void*) calls,
3647 .write = write_LDKSign_jcall,
3648 .cloned = LDKSign_JCalls_cloned,
3649 .free = LDKSign_JCalls_free,
3650 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
3652 calls->BaseSign = ret.BaseSign.this_arg;
3655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
3656 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
3657 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
3658 return (uint64_t)res_ptr;
3660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
3661 LDKSign *inp = (LDKSign *)(arg & ~1);
3662 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
3663 DO_ASSERT((res_ptr & 1) == 0);
3664 return (int64_t)(res_ptr | 1);
3666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3667 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3668 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3669 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
3670 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3673 CVec_u8Z_free(ret_var);
3677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3678 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3679 CHECK(val->result_ok);
3680 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3681 *res_ret = Sign_clone(&(*val->contents.result));
3682 return (uint64_t)res_ret;
3684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3685 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3686 CHECK(!val->result_ok);
3687 LDKDecodeError err_var = (*val->contents.err);
3688 uint64_t err_ref = 0;
3689 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3690 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3691 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3692 err_ref = (uint64_t)err_var.inner & ~1;
3695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3696 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3697 CHECK(val->result_ok);
3698 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3699 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3703 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3704 CHECK(!val->result_ok);
3705 return *val->contents.err;
3707 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3708 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3709 for (size_t i = 0; i < ret.datalen; i++) {
3710 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3714 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3715 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3716 CHECK(val->result_ok);
3717 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3718 jobjectArray res_arr = NULL;
3719 res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3721 for (size_t i = 0; i < res_var.datalen; i++) {
3722 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3723 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3724 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3725 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3731 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3732 CHECK(!val->result_ok);
3733 return *val->contents.err;
3735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3736 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3737 CHECK(val->result_ok);
3738 LDKInMemorySigner res_var = (*val->contents.result);
3739 uint64_t res_ref = 0;
3740 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3741 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3742 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3743 res_ref = (uint64_t)res_var.inner & ~1;
3746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3747 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3748 CHECK(!val->result_ok);
3749 LDKDecodeError err_var = (*val->contents.err);
3750 uint64_t err_ref = 0;
3751 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3754 err_ref = (uint64_t)err_var.inner & ~1;
3757 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3758 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3759 for (size_t i = 0; i < ret.datalen; i++) {
3760 ret.data[i] = TxOut_clone(&orig->data[i]);
3764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3765 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3766 CHECK(val->result_ok);
3767 LDKTransaction res_var = (*val->contents.result);
3768 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3769 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3773 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3774 CHECK(!val->result_ok);
3775 return *val->contents.err;
3777 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3778 return ThirtyTwoBytes_clone(&tuple->a);
3780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3781 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3782 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3783 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data);
3787 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3788 return ChannelMonitor_clone(&tuple->b);
3790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3791 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3792 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
3793 uint64_t ret_ref = 0;
3794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3797 ret_ref = (uint64_t)ret_var.inner;
3798 if (ret_var.is_owned) {
3804 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
3805 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
3806 for (size_t i = 0; i < ret.datalen; i++) {
3807 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
3811 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3812 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3813 CHECK(val->result_ok);
3814 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3815 int64_tArray res_arr = NULL;
3816 res_arr = (*env)->NewLongArray(env, res_var.datalen);
3817 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3818 for (size_t j = 0; j < res_var.datalen; j++) {
3819 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3820 *res_conv_35_conv = res_var.data[j];
3821 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
3822 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
3824 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3828 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3829 CHECK(!val->result_ok);
3830 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3833 static jclass LDKCOption_u16Z_Some_class = NULL;
3834 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3835 static jclass LDKCOption_u16Z_None_class = NULL;
3836 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3838 LDKCOption_u16Z_Some_class =
3839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3840 CHECK(LDKCOption_u16Z_Some_class != NULL);
3841 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3842 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3843 LDKCOption_u16Z_None_class =
3844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3845 CHECK(LDKCOption_u16Z_None_class != NULL);
3846 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3847 CHECK(LDKCOption_u16Z_None_meth != NULL);
3849 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3850 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3852 case LDKCOption_u16Z_Some: {
3853 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3855 case LDKCOption_u16Z_None: {
3856 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3861 static jclass LDKAPIError_APIMisuseError_class = NULL;
3862 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3863 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3864 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3865 static jclass LDKAPIError_RouteError_class = NULL;
3866 static jmethodID LDKAPIError_RouteError_meth = NULL;
3867 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3868 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3869 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3870 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3871 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3872 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3874 LDKAPIError_APIMisuseError_class =
3875 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
3876 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3877 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3878 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3879 LDKAPIError_FeeRateTooHigh_class =
3880 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
3881 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3882 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3883 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3884 LDKAPIError_RouteError_class =
3885 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
3886 CHECK(LDKAPIError_RouteError_class != NULL);
3887 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3888 CHECK(LDKAPIError_RouteError_meth != NULL);
3889 LDKAPIError_ChannelUnavailable_class =
3890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
3891 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3892 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3893 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3894 LDKAPIError_MonitorUpdateFailed_class =
3895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
3896 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3897 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3898 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3899 LDKAPIError_IncompatibleShutdownScript_class =
3900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
3901 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3902 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3903 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3905 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3906 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3908 case LDKAPIError_APIMisuseError: {
3909 LDKStr err_str = obj->api_misuse_error.err;
3910 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3911 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3913 case LDKAPIError_FeeRateTooHigh: {
3914 LDKStr err_str = obj->fee_rate_too_high.err;
3915 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3916 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3918 case LDKAPIError_RouteError: {
3919 LDKStr err_str = obj->route_error.err;
3920 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3921 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3923 case LDKAPIError_ChannelUnavailable: {
3924 LDKStr err_str = obj->channel_unavailable.err;
3925 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3926 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3928 case LDKAPIError_MonitorUpdateFailed: {
3929 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3931 case LDKAPIError_IncompatibleShutdownScript: {
3932 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3933 uint64_t script_ref = 0;
3934 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3935 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3936 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
3937 script_ref = (uint64_t)script_var.inner & ~1;
3938 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3944 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3945 CHECK(val->result_ok);
3946 return *val->contents.result;
3948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3949 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3950 CHECK(!val->result_ok);
3951 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3954 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3955 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3956 for (size_t i = 0; i < ret.datalen; i++) {
3957 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3961 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3962 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3963 for (size_t i = 0; i < ret.datalen; i++) {
3964 ret.data[i] = APIError_clone(&orig->data[i]);
3968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3969 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3970 CHECK(val->result_ok);
3971 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3972 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3976 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3977 CHECK(!val->result_ok);
3978 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3981 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3982 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3983 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3984 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3985 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3986 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3987 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3988 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3990 LDKPaymentSendFailure_ParameterError_class =
3991 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
3992 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3993 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3994 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3995 LDKPaymentSendFailure_PathParameterError_class =
3996 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
3997 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3998 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3999 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4000 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4001 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4002 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4003 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4004 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4005 LDKPaymentSendFailure_PartialFailure_class =
4006 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4007 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
4008 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
4009 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
4011 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4012 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4014 case LDKPaymentSendFailure_ParameterError: {
4015 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
4016 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
4018 case LDKPaymentSendFailure_PathParameterError: {
4019 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4020 int64_tArray path_parameter_error_arr = NULL;
4021 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
4022 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
4023 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4024 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4025 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4026 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4027 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
4029 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
4030 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
4032 case LDKPaymentSendFailure_AllFailedRetrySafe: {
4033 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4034 int64_tArray all_failed_retry_safe_arr = NULL;
4035 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
4036 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
4037 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4038 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
4039 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4041 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
4042 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
4044 case LDKPaymentSendFailure_PartialFailure: {
4045 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4046 int64_tArray results_arr = NULL;
4047 results_arr = (*env)->NewLongArray(env, results_var.datalen);
4048 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
4049 for (size_t w = 0; w < results_var.datalen; w++) {
4050 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4051 *results_conv_22_conv = results_var.data[w];
4052 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4053 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
4055 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
4056 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4057 uint64_t failed_paths_retry_ref = 0;
4058 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
4059 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4060 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4061 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4062 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
4064 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
4065 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
4066 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
4071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4072 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
4073 CHECK(val->result_ok);
4074 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
4075 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
4078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4079 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
4080 CHECK(!val->result_ok);
4081 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4085 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
4086 CHECK(val->result_ok);
4087 return *val->contents.result;
4089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4090 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
4091 CHECK(!val->result_ok);
4092 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4095 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
4096 return ThirtyTwoBytes_clone(&tuple->a);
4098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4099 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
4100 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4101 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data);
4105 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
4106 return ThirtyTwoBytes_clone(&tuple->b);
4108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4109 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
4110 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4111 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data);
4115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4116 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
4117 CHECK(val->result_ok);
4118 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4119 *res_conv = (*val->contents.result);
4120 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
4121 return ((uint64_t)res_conv);
4123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4124 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
4125 CHECK(!val->result_ok);
4126 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4129 static jclass LDKNetAddress_IPv4_class = NULL;
4130 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4131 static jclass LDKNetAddress_IPv6_class = NULL;
4132 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4133 static jclass LDKNetAddress_OnionV2_class = NULL;
4134 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4135 static jclass LDKNetAddress_OnionV3_class = NULL;
4136 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4138 LDKNetAddress_IPv4_class =
4139 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4140 CHECK(LDKNetAddress_IPv4_class != NULL);
4141 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4142 CHECK(LDKNetAddress_IPv4_meth != NULL);
4143 LDKNetAddress_IPv6_class =
4144 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4145 CHECK(LDKNetAddress_IPv6_class != NULL);
4146 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4147 CHECK(LDKNetAddress_IPv6_meth != NULL);
4148 LDKNetAddress_OnionV2_class =
4149 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4150 CHECK(LDKNetAddress_OnionV2_class != NULL);
4151 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4152 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4153 LDKNetAddress_OnionV3_class =
4154 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4155 CHECK(LDKNetAddress_OnionV3_class != NULL);
4156 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4157 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4159 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4160 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4162 case LDKNetAddress_IPv4: {
4163 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4164 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4165 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
4167 case LDKNetAddress_IPv6: {
4168 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4169 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4170 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
4172 case LDKNetAddress_OnionV2: {
4173 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4174 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4175 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4177 case LDKNetAddress_OnionV3: {
4178 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4179 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4180 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);
4185 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4186 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4187 for (size_t i = 0; i < ret.datalen; i++) {
4188 ret.data[i] = NetAddress_clone(&orig->data[i]);
4192 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
4193 return ThirtyTwoBytes_clone(&tuple->a);
4195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4196 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
4197 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4198 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data);
4202 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
4203 return ThirtyTwoBytes_clone(&tuple->b);
4205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4206 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
4207 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4208 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data);
4212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4213 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
4214 CHECK(val->result_ok);
4215 LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4216 *res_conv = (*val->contents.result);
4217 *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv);
4218 return ((uint64_t)res_conv);
4220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4221 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
4222 CHECK(!val->result_ok);
4223 return *val->contents.err;
4225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4226 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
4227 CHECK(val->result_ok);
4228 LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4229 *res_conv = (*val->contents.result);
4230 *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv);
4231 return ((uint64_t)res_conv);
4233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4234 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
4235 CHECK(!val->result_ok);
4236 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4240 LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
4241 CHECK(val->result_ok);
4242 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
4243 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
4246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4247 LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
4248 CHECK(!val->result_ok);
4249 return *val->contents.err;
4251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4252 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
4253 CHECK(val->result_ok);
4254 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
4255 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
4258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4259 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
4260 CHECK(!val->result_ok);
4261 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4265 LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
4266 CHECK(val->result_ok);
4267 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
4268 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
4271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4272 LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
4273 CHECK(!val->result_ok);
4274 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4277 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4278 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4279 for (size_t i = 0; i < ret.datalen; i++) {
4280 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4284 typedef struct LDKWatch_JCalls {
4285 atomic_size_t refcnt;
4288 jmethodID watch_channel_meth;
4289 jmethodID update_channel_meth;
4290 jmethodID release_pending_monitor_events_meth;
4292 static void LDKWatch_JCalls_free(void* this_arg) {
4293 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4294 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4296 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4297 if (get_jenv_res == JNI_EDETACHED) {
4298 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4300 DO_ASSERT(get_jenv_res == JNI_OK);
4302 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4303 if (get_jenv_res == JNI_EDETACHED) {
4304 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4309 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4310 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4312 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4313 if (get_jenv_res == JNI_EDETACHED) {
4314 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4316 DO_ASSERT(get_jenv_res == JNI_OK);
4318 LDKOutPoint funding_txo_var = funding_txo;
4319 uint64_t funding_txo_ref = 0;
4320 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4321 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4322 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4323 funding_txo_ref = (uint64_t)funding_txo_var.inner;
4324 if (funding_txo_var.is_owned) {
4325 funding_txo_ref |= 1;
4327 LDKChannelMonitor monitor_var = monitor;
4328 uint64_t monitor_ref = 0;
4329 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4330 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4331 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4332 monitor_ref = (uint64_t)monitor_var.inner;
4333 if (monitor_var.is_owned) {
4336 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4338 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
4339 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4340 (*env)->ExceptionDescribe(env);
4341 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
4343 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4344 CHECK_ACCESS(ret_ptr);
4345 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4347 if (get_jenv_res == JNI_EDETACHED) {
4348 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4352 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4353 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4355 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4356 if (get_jenv_res == JNI_EDETACHED) {
4357 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4359 DO_ASSERT(get_jenv_res == JNI_OK);
4361 LDKOutPoint funding_txo_var = funding_txo;
4362 uint64_t funding_txo_ref = 0;
4363 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4364 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4365 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4366 funding_txo_ref = (uint64_t)funding_txo_var.inner;
4367 if (funding_txo_var.is_owned) {
4368 funding_txo_ref |= 1;
4370 LDKChannelMonitorUpdate update_var = update;
4371 uint64_t update_ref = 0;
4372 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4373 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4374 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4375 update_ref = (uint64_t)update_var.inner;
4376 if (update_var.is_owned) {
4379 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4381 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
4382 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4383 (*env)->ExceptionDescribe(env);
4384 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
4386 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4387 CHECK_ACCESS(ret_ptr);
4388 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4390 if (get_jenv_res == JNI_EDETACHED) {
4391 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4395 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4396 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4398 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4399 if (get_jenv_res == JNI_EDETACHED) {
4400 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4402 DO_ASSERT(get_jenv_res == JNI_OK);
4404 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4406 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
4407 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4408 (*env)->ExceptionDescribe(env);
4409 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
4411 LDKCVec_MonitorEventZ ret_constr;
4412 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4413 if (ret_constr.datalen > 0)
4414 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4416 ret_constr.data = NULL;
4417 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4418 for (size_t o = 0; o < ret_constr.datalen; o++) {
4419 int64_t ret_conv_14 = ret_vals[o];
4420 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
4421 CHECK_ACCESS(ret_conv_14_ptr);
4422 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
4423 FREE((void*)ret_conv_14);
4424 ret_constr.data[o] = ret_conv_14_conv;
4426 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4427 if (get_jenv_res == JNI_EDETACHED) {
4428 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4432 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4433 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4434 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4436 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
4437 jclass c = (*env)->GetObjectClass(env, o);
4439 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4440 atomic_init(&calls->refcnt, 1);
4441 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4442 calls->o = (*env)->NewWeakGlobalRef(env, o);
4443 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
4444 CHECK(calls->watch_channel_meth != NULL);
4445 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
4446 CHECK(calls->update_channel_meth != NULL);
4447 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
4448 CHECK(calls->release_pending_monitor_events_meth != NULL);
4451 .this_arg = (void*) calls,
4452 .watch_channel = watch_channel_LDKWatch_jcall,
4453 .update_channel = update_channel_LDKWatch_jcall,
4454 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4455 .free = LDKWatch_JCalls_free,
4459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
4460 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4461 *res_ptr = LDKWatch_init(env, clz, o);
4462 return (uint64_t)res_ptr;
4464 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) {
4465 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4466 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4467 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4468 LDKOutPoint funding_txo_conv;
4469 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4470 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4471 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4472 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4473 LDKChannelMonitor monitor_conv;
4474 monitor_conv.inner = (void*)(monitor & (~1));
4475 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
4476 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
4477 monitor_conv = ChannelMonitor_clone(&monitor_conv);
4478 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4479 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4480 return (uint64_t)ret_conv;
4483 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) {
4484 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4485 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4486 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4487 LDKOutPoint funding_txo_conv;
4488 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4489 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4490 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4491 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4492 LDKChannelMonitorUpdate update_conv;
4493 update_conv.inner = (void*)(update & (~1));
4494 update_conv.is_owned = (update & 1) || (update == 0);
4495 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
4496 update_conv = ChannelMonitorUpdate_clone(&update_conv);
4497 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4498 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4499 return (uint64_t)ret_conv;
4502 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4503 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4504 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4505 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4506 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4507 int64_tArray ret_arr = NULL;
4508 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4509 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4510 for (size_t o = 0; o < ret_var.datalen; o++) {
4511 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4512 *ret_conv_14_copy = ret_var.data[o];
4513 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
4514 ret_arr_ptr[o] = ret_conv_14_ref;
4516 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4521 typedef struct LDKBroadcasterInterface_JCalls {
4522 atomic_size_t refcnt;
4525 jmethodID broadcast_transaction_meth;
4526 } LDKBroadcasterInterface_JCalls;
4527 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4528 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4529 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4531 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4532 if (get_jenv_res == JNI_EDETACHED) {
4533 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4535 DO_ASSERT(get_jenv_res == JNI_OK);
4537 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4538 if (get_jenv_res == JNI_EDETACHED) {
4539 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4544 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4545 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4547 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4548 if (get_jenv_res == JNI_EDETACHED) {
4549 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4551 DO_ASSERT(get_jenv_res == JNI_OK);
4553 LDKTransaction tx_var = tx;
4554 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
4555 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
4556 Transaction_free(tx_var);
4557 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4559 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
4560 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4561 (*env)->ExceptionDescribe(env);
4562 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
4564 if (get_jenv_res == JNI_EDETACHED) {
4565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4568 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4569 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4570 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4572 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
4573 jclass c = (*env)->GetObjectClass(env, o);
4575 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4576 atomic_init(&calls->refcnt, 1);
4577 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4578 calls->o = (*env)->NewWeakGlobalRef(env, o);
4579 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
4580 CHECK(calls->broadcast_transaction_meth != NULL);
4582 LDKBroadcasterInterface ret = {
4583 .this_arg = (void*) calls,
4584 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4585 .free = LDKBroadcasterInterface_JCalls_free,
4589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4590 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4591 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
4592 return (uint64_t)res_ptr;
4594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
4595 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4596 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4597 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4598 LDKTransaction tx_ref;
4599 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
4600 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4601 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
4602 tx_ref.data_is_owned = true;
4603 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4606 typedef struct LDKKeysInterface_JCalls {
4607 atomic_size_t refcnt;
4610 jmethodID get_node_secret_meth;
4611 jmethodID get_destination_script_meth;
4612 jmethodID get_shutdown_scriptpubkey_meth;
4613 jmethodID get_channel_signer_meth;
4614 jmethodID get_secure_random_bytes_meth;
4615 jmethodID read_chan_signer_meth;
4616 jmethodID sign_invoice_meth;
4617 jmethodID get_inbound_payment_key_material_meth;
4618 } LDKKeysInterface_JCalls;
4619 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4620 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4621 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4623 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4624 if (get_jenv_res == JNI_EDETACHED) {
4625 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4627 DO_ASSERT(get_jenv_res == JNI_OK);
4629 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4630 if (get_jenv_res == JNI_EDETACHED) {
4631 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4636 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
4637 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4640 if (get_jenv_res == JNI_EDETACHED) {
4641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4643 DO_ASSERT(get_jenv_res == JNI_OK);
4645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4647 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
4648 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4649 (*env)->ExceptionDescribe(env);
4650 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
4652 LDKSecretKey ret_ref;
4653 CHECK((*env)->GetArrayLength(env, ret) == 32);
4654 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
4655 if (get_jenv_res == JNI_EDETACHED) {
4656 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4660 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4661 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4663 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4664 if (get_jenv_res == JNI_EDETACHED) {
4665 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4667 DO_ASSERT(get_jenv_res == JNI_OK);
4669 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4671 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
4672 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4673 (*env)->ExceptionDescribe(env);
4674 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
4676 LDKCVec_u8Z ret_ref;
4677 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4678 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4679 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4680 if (get_jenv_res == JNI_EDETACHED) {
4681 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4685 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4686 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4688 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4689 if (get_jenv_res == JNI_EDETACHED) {
4690 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4692 DO_ASSERT(get_jenv_res == JNI_OK);
4694 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4696 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
4697 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4698 (*env)->ExceptionDescribe(env);
4699 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
4701 LDKShutdownScript ret_conv;
4702 ret_conv.inner = (void*)(ret & (~1));
4703 ret_conv.is_owned = (ret & 1) || (ret == 0);
4704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
4705 if (get_jenv_res == JNI_EDETACHED) {
4706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4710 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4711 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4713 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4714 if (get_jenv_res == JNI_EDETACHED) {
4715 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4717 DO_ASSERT(get_jenv_res == JNI_OK);
4719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4721 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4722 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4723 (*env)->ExceptionDescribe(env);
4724 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4726 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4727 CHECK_ACCESS(ret_ptr);
4728 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4730 if (get_jenv_res == JNI_EDETACHED) {
4731 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4735 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4736 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4738 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4739 if (get_jenv_res == JNI_EDETACHED) {
4740 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4742 DO_ASSERT(get_jenv_res == JNI_OK);
4744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4746 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4747 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4748 (*env)->ExceptionDescribe(env);
4749 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4751 LDKThirtyTwoBytes ret_ref;
4752 CHECK((*env)->GetArrayLength(env, ret) == 32);
4753 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4754 if (get_jenv_res == JNI_EDETACHED) {
4755 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4759 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4760 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4762 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4763 if (get_jenv_res == JNI_EDETACHED) {
4764 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4766 DO_ASSERT(get_jenv_res == JNI_OK);
4768 LDKu8slice reader_var = reader;
4769 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4770 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4773 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4775 (*env)->ExceptionDescribe(env);
4776 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4778 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4779 CHECK_ACCESS(ret_ptr);
4780 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4782 if (get_jenv_res == JNI_EDETACHED) {
4783 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4787 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4788 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4790 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4791 if (get_jenv_res == JNI_EDETACHED) {
4792 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4794 DO_ASSERT(get_jenv_res == JNI_OK);
4796 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4797 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4798 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4799 CVec_u8Z_free(invoice_preimage_var);
4800 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4802 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4803 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4804 (*env)->ExceptionDescribe(env);
4805 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4807 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4808 CHECK_ACCESS(ret_ptr);
4809 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
4811 if (get_jenv_res == JNI_EDETACHED) {
4812 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4816 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
4817 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4819 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4820 if (get_jenv_res == JNI_EDETACHED) {
4821 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4823 DO_ASSERT(get_jenv_res == JNI_OK);
4825 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4827 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
4828 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4829 (*env)->ExceptionDescribe(env);
4830 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
4832 LDKThirtyTwoBytes ret_ref;
4833 CHECK((*env)->GetArrayLength(env, ret) == 32);
4834 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4835 if (get_jenv_res == JNI_EDETACHED) {
4836 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4840 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4841 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4842 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4844 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4845 jclass c = (*env)->GetObjectClass(env, o);
4847 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4848 atomic_init(&calls->refcnt, 1);
4849 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4850 calls->o = (*env)->NewWeakGlobalRef(env, o);
4851 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4852 CHECK(calls->get_node_secret_meth != NULL);
4853 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4854 CHECK(calls->get_destination_script_meth != NULL);
4855 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4856 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4857 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4858 CHECK(calls->get_channel_signer_meth != NULL);
4859 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4860 CHECK(calls->get_secure_random_bytes_meth != NULL);
4861 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4862 CHECK(calls->read_chan_signer_meth != NULL);
4863 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4864 CHECK(calls->sign_invoice_meth != NULL);
4865 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
4866 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
4868 LDKKeysInterface ret = {
4869 .this_arg = (void*) calls,
4870 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4871 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4872 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4873 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4874 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4875 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4876 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4877 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
4878 .free = LDKKeysInterface_JCalls_free,
4882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4883 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4884 *res_ptr = LDKKeysInterface_init(env, clz, o);
4885 return (uint64_t)res_ptr;
4887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4888 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4889 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4890 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4891 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4897 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4898 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4899 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4900 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4901 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4902 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4903 CVec_u8Z_free(ret_var);
4907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4908 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4909 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4910 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4911 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4912 uint64_t ret_ref = 0;
4913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4916 ret_ref = (uint64_t)ret_var.inner;
4917 if (ret_var.is_owned) {
4923 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) {
4924 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4925 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4926 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4927 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4928 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4929 return (uint64_t)ret_ret;
4932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4933 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4934 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4935 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4936 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4937 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4942 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4943 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4944 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4945 LDKu8slice reader_ref;
4946 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4947 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4948 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4949 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4950 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4951 return (uint64_t)ret_conv;
4954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4955 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4956 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4957 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4958 LDKCVec_u8Z invoice_preimage_ref;
4959 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4960 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4961 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4962 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4963 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4964 return (uint64_t)ret_conv;
4967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
4968 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4969 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4970 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4971 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4972 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
4976 typedef struct LDKFeeEstimator_JCalls {
4977 atomic_size_t refcnt;
4980 jmethodID get_est_sat_per_1000_weight_meth;
4981 } LDKFeeEstimator_JCalls;
4982 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4983 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4984 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4986 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4987 if (get_jenv_res == JNI_EDETACHED) {
4988 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4990 DO_ASSERT(get_jenv_res == JNI_OK);
4992 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4993 if (get_jenv_res == JNI_EDETACHED) {
4994 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4999 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5000 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5002 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5003 if (get_jenv_res == JNI_EDETACHED) {
5004 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5006 DO_ASSERT(get_jenv_res == JNI_OK);
5008 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
5009 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5011 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
5012 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5013 (*env)->ExceptionDescribe(env);
5014 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
5016 if (get_jenv_res == JNI_EDETACHED) {
5017 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5021 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5022 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5023 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5025 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
5026 jclass c = (*env)->GetObjectClass(env, o);
5028 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5029 atomic_init(&calls->refcnt, 1);
5030 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5031 calls->o = (*env)->NewWeakGlobalRef(env, o);
5032 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
5033 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
5035 LDKFeeEstimator ret = {
5036 .this_arg = (void*) calls,
5037 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5038 .free = LDKFeeEstimator_JCalls_free,
5042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
5043 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5044 *res_ptr = LDKFeeEstimator_init(env, clz, o);
5045 return (uint64_t)res_ptr;
5047 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) {
5048 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5049 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5050 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5051 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
5052 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5056 typedef struct LDKLogger_JCalls {
5057 atomic_size_t refcnt;
5062 static void LDKLogger_JCalls_free(void* this_arg) {
5063 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5064 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5066 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5067 if (get_jenv_res == JNI_EDETACHED) {
5068 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5070 DO_ASSERT(get_jenv_res == JNI_OK);
5072 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5073 if (get_jenv_res == JNI_EDETACHED) {
5074 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5079 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
5080 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5082 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5083 if (get_jenv_res == JNI_EDETACHED) {
5084 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5086 DO_ASSERT(get_jenv_res == JNI_OK);
5088 LDKRecord record_var = *record;
5089 uint64_t record_ref = 0;
5090 record_var = Record_clone(record);
5091 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5092 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5093 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5094 record_ref = (uint64_t)record_var.inner;
5095 if (record_var.is_owned) {
5098 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5100 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5101 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5102 (*env)->ExceptionDescribe(env);
5103 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5105 if (get_jenv_res == JNI_EDETACHED) {
5106 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5109 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5110 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5111 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5113 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5114 jclass c = (*env)->GetObjectClass(env, o);
5116 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5117 atomic_init(&calls->refcnt, 1);
5118 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5119 calls->o = (*env)->NewWeakGlobalRef(env, o);
5120 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5121 CHECK(calls->log_meth != NULL);
5124 .this_arg = (void*) calls,
5125 .log = log_LDKLogger_jcall,
5126 .free = LDKLogger_JCalls_free,
5130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5131 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5132 *res_ptr = LDKLogger_init(env, clz, o);
5133 return (uint64_t)res_ptr;
5135 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
5136 return ThirtyTwoBytes_clone(&tuple->a);
5138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5139 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
5140 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5141 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data);
5145 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
5148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5149 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
5150 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
5151 uint64_t ret_ref = 0;
5152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5155 ret_ref = (uint64_t)ret_var.inner & ~1;
5159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5160 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
5161 CHECK(val->result_ok);
5162 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
5163 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
5164 return ((uint64_t)res_conv) | 1;
5166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5167 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
5168 CHECK(!val->result_ok);
5169 LDKDecodeError err_var = (*val->contents.err);
5170 uint64_t err_ref = 0;
5171 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5172 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5173 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5174 err_ref = (uint64_t)err_var.inner & ~1;
5177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5178 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
5179 CHECK(val->result_ok);
5180 LDKChannelConfig res_var = (*val->contents.result);
5181 uint64_t res_ref = 0;
5182 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5183 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5184 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5185 res_ref = (uint64_t)res_var.inner & ~1;
5188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5189 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
5190 CHECK(!val->result_ok);
5191 LDKDecodeError err_var = (*val->contents.err);
5192 uint64_t err_ref = 0;
5193 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5194 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5195 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5196 err_ref = (uint64_t)err_var.inner & ~1;
5199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5200 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
5201 CHECK(val->result_ok);
5202 LDKOutPoint res_var = (*val->contents.result);
5203 uint64_t res_ref = 0;
5204 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5205 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5206 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5207 res_ref = (uint64_t)res_var.inner & ~1;
5210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5211 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
5212 CHECK(!val->result_ok);
5213 LDKDecodeError err_var = (*val->contents.err);
5214 uint64_t err_ref = 0;
5215 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5216 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5217 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5218 err_ref = (uint64_t)err_var.inner & ~1;
5221 typedef struct LDKType_JCalls {
5222 atomic_size_t refcnt;
5225 jmethodID type_id_meth;
5226 jmethodID debug_str_meth;
5227 jmethodID write_meth;
5229 static void LDKType_JCalls_free(void* this_arg) {
5230 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5231 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5233 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5234 if (get_jenv_res == JNI_EDETACHED) {
5235 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5237 DO_ASSERT(get_jenv_res == JNI_OK);
5239 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5240 if (get_jenv_res == JNI_EDETACHED) {
5241 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5246 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5247 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5249 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5250 if (get_jenv_res == JNI_EDETACHED) {
5251 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5253 DO_ASSERT(get_jenv_res == JNI_OK);
5255 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5257 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
5258 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5259 (*env)->ExceptionDescribe(env);
5260 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
5262 if (get_jenv_res == JNI_EDETACHED) {
5263 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5267 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5268 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5270 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5271 if (get_jenv_res == JNI_EDETACHED) {
5272 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5274 DO_ASSERT(get_jenv_res == JNI_OK);
5276 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5278 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
5279 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5280 (*env)->ExceptionDescribe(env);
5281 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
5283 LDKStr ret_conv = java_to_owned_str(env, ret);
5284 if (get_jenv_res == JNI_EDETACHED) {
5285 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5289 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5290 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5292 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5293 if (get_jenv_res == JNI_EDETACHED) {
5294 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5296 DO_ASSERT(get_jenv_res == JNI_OK);
5298 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5300 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5301 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5302 (*env)->ExceptionDescribe(env);
5303 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
5305 LDKCVec_u8Z ret_ref;
5306 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5307 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5308 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5309 if (get_jenv_res == JNI_EDETACHED) {
5310 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5314 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5315 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5316 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5318 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
5319 jclass c = (*env)->GetObjectClass(env, o);
5321 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5322 atomic_init(&calls->refcnt, 1);
5323 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5324 calls->o = (*env)->NewWeakGlobalRef(env, o);
5325 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
5326 CHECK(calls->type_id_meth != NULL);
5327 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
5328 CHECK(calls->debug_str_meth != NULL);
5329 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5330 CHECK(calls->write_meth != NULL);
5333 .this_arg = (void*) calls,
5334 .type_id = type_id_LDKType_jcall,
5335 .debug_str = debug_str_LDKType_jcall,
5336 .write = write_LDKType_jcall,
5337 .cloned = LDKType_JCalls_cloned,
5338 .free = LDKType_JCalls_free,
5342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
5343 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5344 *res_ptr = LDKType_init(env, clz, o);
5345 return (uint64_t)res_ptr;
5347 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5348 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5349 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5350 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5351 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5355 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
5356 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5357 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5358 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5359 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5360 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
5365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5366 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5367 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5368 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5369 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5372 CVec_u8Z_free(ret_var);
5376 static jclass LDKCOption_TypeZ_Some_class = NULL;
5377 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
5378 static jclass LDKCOption_TypeZ_None_class = NULL;
5379 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
5380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
5381 LDKCOption_TypeZ_Some_class =
5382 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
5383 CHECK(LDKCOption_TypeZ_Some_class != NULL);
5384 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
5385 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
5386 LDKCOption_TypeZ_None_class =
5387 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
5388 CHECK(LDKCOption_TypeZ_None_class != NULL);
5389 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
5390 CHECK(LDKCOption_TypeZ_None_meth != NULL);
5392 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5393 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5395 case LDKCOption_TypeZ_Some: {
5396 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5397 *some_ret = Type_clone(&obj->some);
5398 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
5400 case LDKCOption_TypeZ_None: {
5401 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
5406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5407 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
5408 CHECK(val->result_ok);
5409 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5413 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
5414 CHECK(!val->result_ok);
5415 LDKDecodeError err_var = (*val->contents.err);
5416 uint64_t err_ref = 0;
5417 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5418 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5419 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5420 err_ref = (uint64_t)err_var.inner & ~1;
5423 static jclass LDKPaymentError_Invoice_class = NULL;
5424 static jmethodID LDKPaymentError_Invoice_meth = NULL;
5425 static jclass LDKPaymentError_Routing_class = NULL;
5426 static jmethodID LDKPaymentError_Routing_meth = NULL;
5427 static jclass LDKPaymentError_Sending_class = NULL;
5428 static jmethodID LDKPaymentError_Sending_meth = NULL;
5429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
5430 LDKPaymentError_Invoice_class =
5431 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
5432 CHECK(LDKPaymentError_Invoice_class != NULL);
5433 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
5434 CHECK(LDKPaymentError_Invoice_meth != NULL);
5435 LDKPaymentError_Routing_class =
5436 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
5437 CHECK(LDKPaymentError_Routing_class != NULL);
5438 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
5439 CHECK(LDKPaymentError_Routing_meth != NULL);
5440 LDKPaymentError_Sending_class =
5441 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
5442 CHECK(LDKPaymentError_Sending_class != NULL);
5443 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
5444 CHECK(LDKPaymentError_Sending_meth != NULL);
5446 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5447 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5449 case LDKPaymentError_Invoice: {
5450 LDKStr invoice_str = obj->invoice;
5451 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
5452 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
5454 case LDKPaymentError_Routing: {
5455 LDKLightningError routing_var = obj->routing;
5456 uint64_t routing_ref = 0;
5457 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5458 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5459 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5460 routing_ref = (uint64_t)routing_var.inner & ~1;
5461 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
5463 case LDKPaymentError_Sending: {
5464 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
5465 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
5470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5471 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
5472 CHECK(val->result_ok);
5473 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
5474 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
5477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5478 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
5479 CHECK(!val->result_ok);
5480 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5483 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5484 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
5485 CHECK(val->result_ok);
5486 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
5489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5490 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
5491 CHECK(!val->result_ok);
5492 return *val->contents.err;
5494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5495 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
5496 CHECK(val->result_ok);
5497 LDKInvoice res_var = (*val->contents.result);
5498 uint64_t res_ref = 0;
5499 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5500 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5501 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5502 res_ref = (uint64_t)res_var.inner & ~1;
5505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5506 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
5507 CHECK(!val->result_ok);
5508 return *val->contents.err;
5510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5511 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
5512 CHECK(val->result_ok);
5513 LDKSignedRawInvoice res_var = (*val->contents.result);
5514 uint64_t res_ref = 0;
5515 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5516 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5517 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5518 res_ref = (uint64_t)res_var.inner & ~1;
5521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5522 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
5523 CHECK(!val->result_ok);
5524 return *val->contents.err;
5526 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5527 return RawInvoice_clone(&tuple->a);
5529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5530 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5531 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
5532 uint64_t ret_ref = 0;
5533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5536 ret_ref = (uint64_t)ret_var.inner;
5537 if (ret_var.is_owned) {
5543 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5544 return ThirtyTwoBytes_clone(&tuple->b);
5546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5547 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5548 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5549 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data);
5553 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5554 return InvoiceSignature_clone(&tuple->c);
5556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
5557 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5558 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
5559 uint64_t ret_ref = 0;
5560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5563 ret_ref = (uint64_t)ret_var.inner;
5564 if (ret_var.is_owned) {
5570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5571 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
5572 CHECK(val->result_ok);
5573 LDKPayeePubKey res_var = (*val->contents.result);
5574 uint64_t res_ref = 0;
5575 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5576 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5577 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5578 res_ref = (uint64_t)res_var.inner & ~1;
5581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5582 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
5583 CHECK(!val->result_ok);
5584 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5587 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5588 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5589 for (size_t i = 0; i < ret.datalen; i++) {
5590 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5595 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
5596 CHECK(val->result_ok);
5597 LDKPositiveTimestamp res_var = (*val->contents.result);
5598 uint64_t res_ref = 0;
5599 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5600 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5601 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5602 res_ref = (uint64_t)res_var.inner & ~1;
5605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5606 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
5607 CHECK(!val->result_ok);
5608 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5612 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
5613 CHECK(val->result_ok);
5614 return *val->contents.result;
5616 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5617 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
5618 CHECK(!val->result_ok);
5619 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
5622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5623 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
5624 CHECK(val->result_ok);
5625 LDKInvoice res_var = (*val->contents.result);
5626 uint64_t res_ref = 0;
5627 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5628 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5629 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5630 res_ref = (uint64_t)res_var.inner & ~1;
5633 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5634 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
5635 CHECK(!val->result_ok);
5636 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
5639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5640 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5641 CHECK(val->result_ok);
5642 LDKDescription res_var = (*val->contents.result);
5643 uint64_t res_ref = 0;
5644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5646 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5647 res_ref = (uint64_t)res_var.inner & ~1;
5650 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5651 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5652 CHECK(!val->result_ok);
5653 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5657 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5658 CHECK(val->result_ok);
5659 LDKExpiryTime res_var = (*val->contents.result);
5660 uint64_t res_ref = 0;
5661 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5662 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5663 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5664 res_ref = (uint64_t)res_var.inner & ~1;
5667 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5668 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5669 CHECK(!val->result_ok);
5670 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5674 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5675 CHECK(val->result_ok);
5676 LDKPrivateRoute res_var = (*val->contents.result);
5677 uint64_t res_ref = 0;
5678 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5679 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5680 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5681 res_ref = (uint64_t)res_var.inner & ~1;
5684 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5685 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5686 CHECK(!val->result_ok);
5687 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5690 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5691 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5692 CHECK(val->result_ok);
5693 LDKStr res_str = (*val->contents.result);
5694 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
5697 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5698 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5699 CHECK(!val->result_ok);
5700 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5704 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5705 CHECK(val->result_ok);
5706 LDKChannelMonitorUpdate res_var = (*val->contents.result);
5707 uint64_t res_ref = 0;
5708 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5709 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5710 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5711 res_ref = (uint64_t)res_var.inner & ~1;
5714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5715 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5716 CHECK(!val->result_ok);
5717 LDKDecodeError err_var = (*val->contents.err);
5718 uint64_t err_ref = 0;
5719 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5720 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5721 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5722 err_ref = (uint64_t)err_var.inner & ~1;
5725 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
5726 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
5727 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
5728 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
5729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
5730 LDKCOption_MonitorEventZ_Some_class =
5731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
5732 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
5733 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
5734 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
5735 LDKCOption_MonitorEventZ_None_class =
5736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
5737 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
5738 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
5739 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
5741 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5742 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
5744 case LDKCOption_MonitorEventZ_Some: {
5745 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
5746 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
5748 case LDKCOption_MonitorEventZ_None: {
5749 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
5754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5755 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
5756 CHECK(val->result_ok);
5757 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5761 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
5762 CHECK(!val->result_ok);
5763 LDKDecodeError err_var = (*val->contents.err);
5764 uint64_t err_ref = 0;
5765 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5766 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5767 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5768 err_ref = (uint64_t)err_var.inner & ~1;
5771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5772 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5773 CHECK(val->result_ok);
5774 LDKHTLCUpdate res_var = (*val->contents.result);
5775 uint64_t res_ref = 0;
5776 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5777 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5778 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5779 res_ref = (uint64_t)res_var.inner & ~1;
5782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5783 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5784 CHECK(!val->result_ok);
5785 LDKDecodeError err_var = (*val->contents.err);
5786 uint64_t err_ref = 0;
5787 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5788 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5789 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5790 err_ref = (uint64_t)err_var.inner & ~1;
5793 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5794 return OutPoint_clone(&tuple->a);
5796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5797 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5798 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
5799 uint64_t ret_ref = 0;
5800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5803 ret_ref = (uint64_t)ret_var.inner;
5804 if (ret_var.is_owned) {
5810 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5811 return CVec_u8Z_clone(&tuple->b);
5813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5814 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5815 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
5816 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5817 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5818 CVec_u8Z_free(ret_var);
5822 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5825 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5826 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5827 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
5831 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5832 return CVec_u8Z_clone(&tuple->b);
5834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5835 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5836 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
5837 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5838 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5839 CVec_u8Z_free(ret_var);
5843 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5844 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5845 for (size_t i = 0; i < ret.datalen; i++) {
5846 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5850 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5851 return ThirtyTwoBytes_clone(&tuple->a);
5853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5854 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5855 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5856 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data);
5860 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5861 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
5863 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5864 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5865 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
5866 int64_tArray ret_arr = NULL;
5867 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5868 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5869 for (size_t v = 0; v < ret_var.datalen; v++) {
5870 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5871 *ret_conv_21_conv = ret_var.data[v];
5872 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
5874 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5879 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5880 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 };
5881 for (size_t i = 0; i < ret.datalen; i++) {
5882 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5886 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5887 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5888 for (size_t i = 0; i < ret.datalen; i++) {
5889 ret.data[i] = Event_clone(&orig->data[i]);
5893 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5896 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5897 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5898 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
5902 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5903 return TxOut_clone(&tuple->b);
5905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5906 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5907 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5908 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
5909 return (uint64_t)ret_ref;
5912 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5913 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5914 for (size_t i = 0; i < ret.datalen; i++) {
5915 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5919 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5920 return ThirtyTwoBytes_clone(&tuple->a);
5922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5923 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5924 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5925 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data);
5929 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5930 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
5932 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5933 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5934 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
5935 int64_tArray ret_arr = NULL;
5936 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5937 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5938 for (size_t u = 0; u < ret_var.datalen; u++) {
5939 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5940 *ret_conv_20_conv = ret_var.data[u];
5941 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
5943 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5948 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5949 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 };
5950 for (size_t i = 0; i < ret.datalen; i++) {
5951 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5955 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5956 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5957 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5958 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5959 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5960 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5961 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5962 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5964 LDKBalance_ClaimableOnChannelClose_class =
5965 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
5966 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5967 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5968 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5969 LDKBalance_ClaimableAwaitingConfirmations_class =
5970 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
5971 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5972 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5973 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5974 LDKBalance_ContentiousClaimable_class =
5975 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
5976 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5977 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5978 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5979 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5980 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
5981 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5982 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5983 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5986 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5988 case LDKBalance_ClaimableOnChannelClose: {
5989 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5991 case LDKBalance_ClaimableAwaitingConfirmations: {
5992 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5994 case LDKBalance_ContentiousClaimable: {
5995 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5997 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5998 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
6003 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6004 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6005 for (size_t i = 0; i < ret.datalen; i++) {
6006 ret.data[i] = Balance_clone(&orig->data[i]);
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6011 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
6012 CHECK(val->result_ok);
6013 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6014 *res_conv = (*val->contents.result);
6015 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
6016 return ((uint64_t)res_conv);
6018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6019 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
6020 CHECK(!val->result_ok);
6021 LDKDecodeError err_var = (*val->contents.err);
6022 uint64_t err_ref = 0;
6023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6026 err_ref = (uint64_t)err_var.inner & ~1;
6029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6030 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
6031 CHECK(val->result_ok);
6032 return *val->contents.result;
6034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6035 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
6036 CHECK(!val->result_ok);
6037 LDKLightningError err_var = (*val->contents.err);
6038 uint64_t err_ref = 0;
6039 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6040 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6041 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6042 err_ref = (uint64_t)err_var.inner & ~1;
6045 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
6048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
6049 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
6050 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6051 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form);
6055 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
6056 return Type_clone(&tuple->b);
6058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
6059 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
6060 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6061 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
6062 return (uint64_t)ret_ret;
6065 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6066 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6067 for (size_t i = 0; i < ret.datalen; i++) {
6068 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6073 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
6074 CHECK(val->result_ok);
6075 return *val->contents.result;
6077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6078 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
6079 CHECK(!val->result_ok);
6080 LDKLightningError err_var = (*val->contents.err);
6081 uint64_t err_ref = 0;
6082 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6083 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6084 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6085 err_ref = (uint64_t)err_var.inner & ~1;
6088 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6089 return ChannelAnnouncement_clone(&tuple->a);
6091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
6092 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6093 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
6094 uint64_t ret_ref = 0;
6095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6098 ret_ref = (uint64_t)ret_var.inner;
6099 if (ret_var.is_owned) {
6105 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6106 return ChannelUpdate_clone(&tuple->b);
6108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
6109 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6110 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
6111 uint64_t ret_ref = 0;
6112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6115 ret_ref = (uint64_t)ret_var.inner;
6116 if (ret_var.is_owned) {
6122 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6123 return ChannelUpdate_clone(&tuple->c);
6125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
6126 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6127 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
6128 uint64_t ret_ref = 0;
6129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6132 ret_ref = (uint64_t)ret_var.inner;
6133 if (ret_var.is_owned) {
6139 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
6140 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
6141 for (size_t i = 0; i < ret.datalen; i++) {
6142 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
6146 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
6147 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
6148 for (size_t i = 0; i < ret.datalen; i++) {
6149 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
6153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6154 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6155 CHECK(val->result_ok);
6156 LDKCVec_u8Z res_var = (*val->contents.result);
6157 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
6158 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
6161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6162 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6163 CHECK(!val->result_ok);
6164 LDKPeerHandleError err_var = (*val->contents.err);
6165 uint64_t err_ref = 0;
6166 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6167 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6168 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6169 err_ref = (uint64_t)err_var.inner & ~1;
6172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6173 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6174 CHECK(val->result_ok);
6175 return *val->contents.result;
6177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6178 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6179 CHECK(!val->result_ok);
6180 LDKPeerHandleError err_var = (*val->contents.err);
6181 uint64_t err_ref = 0;
6182 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6183 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6184 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6185 err_ref = (uint64_t)err_var.inner & ~1;
6188 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6189 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6190 CHECK(val->result_ok);
6191 return *val->contents.result;
6193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6194 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6195 CHECK(!val->result_ok);
6196 LDKPeerHandleError err_var = (*val->contents.err);
6197 uint64_t err_ref = 0;
6198 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6199 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6200 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6201 err_ref = (uint64_t)err_var.inner & ~1;
6204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6205 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6206 CHECK(val->result_ok);
6207 LDKNodeId res_var = (*val->contents.result);
6208 uint64_t res_ref = 0;
6209 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6210 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6211 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6212 res_ref = (uint64_t)res_var.inner & ~1;
6215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6216 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6217 CHECK(!val->result_ok);
6218 LDKDecodeError err_var = (*val->contents.err);
6219 uint64_t err_ref = 0;
6220 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6221 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6222 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6223 err_ref = (uint64_t)err_var.inner & ~1;
6226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6227 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
6228 CHECK(val->result_ok);
6229 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6233 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
6234 CHECK(!val->result_ok);
6235 LDKDecodeError err_var = (*val->contents.err);
6236 uint64_t err_ref = 0;
6237 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6238 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6239 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6240 err_ref = (uint64_t)err_var.inner & ~1;
6243 typedef struct LDKAccess_JCalls {
6244 atomic_size_t refcnt;
6247 jmethodID get_utxo_meth;
6249 static void LDKAccess_JCalls_free(void* this_arg) {
6250 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6251 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6253 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6254 if (get_jenv_res == JNI_EDETACHED) {
6255 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6257 DO_ASSERT(get_jenv_res == JNI_OK);
6259 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6260 if (get_jenv_res == JNI_EDETACHED) {
6261 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6266 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6267 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6269 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6270 if (get_jenv_res == JNI_EDETACHED) {
6271 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6273 DO_ASSERT(get_jenv_res == JNI_OK);
6275 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6276 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6279 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6280 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6281 (*env)->ExceptionDescribe(env);
6282 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6284 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6285 CHECK_ACCESS(ret_ptr);
6286 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
6288 if (get_jenv_res == JNI_EDETACHED) {
6289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6293 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6294 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6295 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6297 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6298 jclass c = (*env)->GetObjectClass(env, o);
6300 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6301 atomic_init(&calls->refcnt, 1);
6302 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6303 calls->o = (*env)->NewWeakGlobalRef(env, o);
6304 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6305 CHECK(calls->get_utxo_meth != NULL);
6308 .this_arg = (void*) calls,
6309 .get_utxo = get_utxo_LDKAccess_jcall,
6310 .free = LDKAccess_JCalls_free,
6314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6315 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6316 *res_ptr = LDKAccess_init(env, clz, o);
6317 return (uint64_t)res_ptr;
6319 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) {
6320 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6321 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6322 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
6323 unsigned char genesis_hash_arr[32];
6324 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6325 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6326 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6327 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6328 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6329 return (uint64_t)ret_conv;
6332 static jclass LDKCOption_AccessZ_Some_class = NULL;
6333 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
6334 static jclass LDKCOption_AccessZ_None_class = NULL;
6335 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
6336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
6337 LDKCOption_AccessZ_Some_class =
6338 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
6339 CHECK(LDKCOption_AccessZ_Some_class != NULL);
6340 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
6341 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
6342 LDKCOption_AccessZ_None_class =
6343 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
6344 CHECK(LDKCOption_AccessZ_None_class != NULL);
6345 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
6346 CHECK(LDKCOption_AccessZ_None_meth != NULL);
6348 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6349 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6351 case LDKCOption_AccessZ_Some: {
6352 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
6353 *some_ret = obj->some;
6354 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
6355 if ((*some_ret).free == LDKAccess_JCalls_free) {
6356 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6357 LDKAccess_JCalls_cloned(&(*some_ret));
6359 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
6361 case LDKCOption_AccessZ_None: {
6362 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
6367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6368 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6369 CHECK(val->result_ok);
6370 LDKDirectionalChannelInfo res_var = (*val->contents.result);
6371 uint64_t res_ref = 0;
6372 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6373 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6374 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6375 res_ref = (uint64_t)res_var.inner & ~1;
6378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6379 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6380 CHECK(!val->result_ok);
6381 LDKDecodeError err_var = (*val->contents.err);
6382 uint64_t err_ref = 0;
6383 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6384 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6385 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6386 err_ref = (uint64_t)err_var.inner & ~1;
6389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6390 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6391 CHECK(val->result_ok);
6392 LDKChannelInfo res_var = (*val->contents.result);
6393 uint64_t res_ref = 0;
6394 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6395 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6396 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6397 res_ref = (uint64_t)res_var.inner & ~1;
6400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6401 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6402 CHECK(!val->result_ok);
6403 LDKDecodeError err_var = (*val->contents.err);
6404 uint64_t err_ref = 0;
6405 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6406 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6407 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6408 err_ref = (uint64_t)err_var.inner & ~1;
6411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6412 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6413 CHECK(val->result_ok);
6414 LDKRoutingFees res_var = (*val->contents.result);
6415 uint64_t res_ref = 0;
6416 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6417 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6418 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6419 res_ref = (uint64_t)res_var.inner & ~1;
6422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6423 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6424 CHECK(!val->result_ok);
6425 LDKDecodeError err_var = (*val->contents.err);
6426 uint64_t err_ref = 0;
6427 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6428 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6429 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6430 err_ref = (uint64_t)err_var.inner & ~1;
6433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6434 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6435 CHECK(val->result_ok);
6436 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
6437 uint64_t res_ref = 0;
6438 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6439 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6440 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6441 res_ref = (uint64_t)res_var.inner & ~1;
6444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6445 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6446 CHECK(!val->result_ok);
6447 LDKDecodeError err_var = (*val->contents.err);
6448 uint64_t err_ref = 0;
6449 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6450 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6451 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6452 err_ref = (uint64_t)err_var.inner & ~1;
6455 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6456 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6457 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6461 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6462 CHECK(val->result_ok);
6463 LDKNodeInfo res_var = (*val->contents.result);
6464 uint64_t res_ref = 0;
6465 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6466 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6467 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6468 res_ref = (uint64_t)res_var.inner & ~1;
6471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6472 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6473 CHECK(!val->result_ok);
6474 LDKDecodeError err_var = (*val->contents.err);
6475 uint64_t err_ref = 0;
6476 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6477 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6478 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6479 err_ref = (uint64_t)err_var.inner & ~1;
6482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6483 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6484 CHECK(val->result_ok);
6485 LDKNetworkGraph res_var = (*val->contents.result);
6486 uint64_t res_ref = 0;
6487 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6488 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6489 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6490 res_ref = (uint64_t)res_var.inner & ~1;
6493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6494 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6495 CHECK(!val->result_ok);
6496 LDKDecodeError err_var = (*val->contents.err);
6497 uint64_t err_ref = 0;
6498 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6499 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6500 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6501 err_ref = (uint64_t)err_var.inner & ~1;
6504 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6505 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6506 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6507 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6509 LDKCOption_CVec_NetAddressZZ_Some_class =
6510 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
6511 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6512 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6513 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6514 LDKCOption_CVec_NetAddressZZ_None_class =
6515 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
6516 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6517 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6518 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6520 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6521 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6523 case LDKCOption_CVec_NetAddressZZ_Some: {
6524 LDKCVec_NetAddressZ some_var = obj->some;
6525 int64_tArray some_arr = NULL;
6526 some_arr = (*env)->NewLongArray(env, some_var.datalen);
6527 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6528 for (size_t m = 0; m < some_var.datalen; m++) {
6529 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
6530 some_arr_ptr[m] = some_conv_12_ref;
6532 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6533 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6535 case LDKCOption_CVec_NetAddressZZ_None: {
6536 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6542 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6543 CHECK(val->result_ok);
6544 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6548 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6549 CHECK(!val->result_ok);
6550 LDKDecodeError err_var = (*val->contents.err);
6551 uint64_t err_ref = 0;
6552 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6553 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6554 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6555 err_ref = (uint64_t)err_var.inner & ~1;
6558 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6559 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6560 for (size_t i = 0; i < ret.datalen; i++) {
6561 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6565 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6566 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6567 for (size_t i = 0; i < ret.datalen; i++) {
6568 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6572 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6573 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6574 for (size_t i = 0; i < ret.datalen; i++) {
6575 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6579 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6580 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6581 for (size_t i = 0; i < ret.datalen; i++) {
6582 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6587 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6588 CHECK(val->result_ok);
6589 LDKAcceptChannel res_var = (*val->contents.result);
6590 uint64_t res_ref = 0;
6591 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6592 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6593 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6594 res_ref = (uint64_t)res_var.inner & ~1;
6597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6598 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6599 CHECK(!val->result_ok);
6600 LDKDecodeError err_var = (*val->contents.err);
6601 uint64_t err_ref = 0;
6602 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6603 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6604 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6605 err_ref = (uint64_t)err_var.inner & ~1;
6608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6609 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6610 CHECK(val->result_ok);
6611 LDKAnnouncementSignatures res_var = (*val->contents.result);
6612 uint64_t res_ref = 0;
6613 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6614 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6615 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6616 res_ref = (uint64_t)res_var.inner & ~1;
6619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6620 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6621 CHECK(!val->result_ok);
6622 LDKDecodeError err_var = (*val->contents.err);
6623 uint64_t err_ref = 0;
6624 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6625 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6626 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6627 err_ref = (uint64_t)err_var.inner & ~1;
6630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6631 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6632 CHECK(val->result_ok);
6633 LDKChannelReestablish res_var = (*val->contents.result);
6634 uint64_t res_ref = 0;
6635 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6636 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6637 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6638 res_ref = (uint64_t)res_var.inner & ~1;
6641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6642 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6643 CHECK(!val->result_ok);
6644 LDKDecodeError err_var = (*val->contents.err);
6645 uint64_t err_ref = 0;
6646 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6647 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6648 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6649 err_ref = (uint64_t)err_var.inner & ~1;
6652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6653 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6654 CHECK(val->result_ok);
6655 LDKClosingSigned res_var = (*val->contents.result);
6656 uint64_t res_ref = 0;
6657 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6658 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6659 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6660 res_ref = (uint64_t)res_var.inner & ~1;
6663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6664 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6665 CHECK(!val->result_ok);
6666 LDKDecodeError err_var = (*val->contents.err);
6667 uint64_t err_ref = 0;
6668 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6669 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6670 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6671 err_ref = (uint64_t)err_var.inner & ~1;
6674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6675 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6676 CHECK(val->result_ok);
6677 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6678 uint64_t res_ref = 0;
6679 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6680 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6681 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6682 res_ref = (uint64_t)res_var.inner & ~1;
6685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6686 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6687 CHECK(!val->result_ok);
6688 LDKDecodeError err_var = (*val->contents.err);
6689 uint64_t err_ref = 0;
6690 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6691 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6692 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6693 err_ref = (uint64_t)err_var.inner & ~1;
6696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6697 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6698 CHECK(val->result_ok);
6699 LDKCommitmentSigned res_var = (*val->contents.result);
6700 uint64_t res_ref = 0;
6701 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6702 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6703 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6704 res_ref = (uint64_t)res_var.inner & ~1;
6707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6708 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6709 CHECK(!val->result_ok);
6710 LDKDecodeError err_var = (*val->contents.err);
6711 uint64_t err_ref = 0;
6712 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6713 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6714 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6715 err_ref = (uint64_t)err_var.inner & ~1;
6718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6719 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6720 CHECK(val->result_ok);
6721 LDKFundingCreated res_var = (*val->contents.result);
6722 uint64_t res_ref = 0;
6723 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6724 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6725 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6726 res_ref = (uint64_t)res_var.inner & ~1;
6729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6730 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6731 CHECK(!val->result_ok);
6732 LDKDecodeError err_var = (*val->contents.err);
6733 uint64_t err_ref = 0;
6734 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6735 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6736 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6737 err_ref = (uint64_t)err_var.inner & ~1;
6740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6741 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6742 CHECK(val->result_ok);
6743 LDKFundingSigned res_var = (*val->contents.result);
6744 uint64_t res_ref = 0;
6745 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6746 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6747 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6748 res_ref = (uint64_t)res_var.inner & ~1;
6751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6752 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6753 CHECK(!val->result_ok);
6754 LDKDecodeError err_var = (*val->contents.err);
6755 uint64_t err_ref = 0;
6756 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6757 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6758 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6759 err_ref = (uint64_t)err_var.inner & ~1;
6762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6763 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6764 CHECK(val->result_ok);
6765 LDKFundingLocked res_var = (*val->contents.result);
6766 uint64_t res_ref = 0;
6767 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6768 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6769 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6770 res_ref = (uint64_t)res_var.inner & ~1;
6773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6774 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6775 CHECK(!val->result_ok);
6776 LDKDecodeError err_var = (*val->contents.err);
6777 uint64_t err_ref = 0;
6778 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6779 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6780 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6781 err_ref = (uint64_t)err_var.inner & ~1;
6784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6785 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6786 CHECK(val->result_ok);
6787 LDKInit res_var = (*val->contents.result);
6788 uint64_t res_ref = 0;
6789 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6790 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6791 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6792 res_ref = (uint64_t)res_var.inner & ~1;
6795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6796 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6797 CHECK(!val->result_ok);
6798 LDKDecodeError err_var = (*val->contents.err);
6799 uint64_t err_ref = 0;
6800 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6801 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6802 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6803 err_ref = (uint64_t)err_var.inner & ~1;
6806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6807 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6808 CHECK(val->result_ok);
6809 LDKOpenChannel res_var = (*val->contents.result);
6810 uint64_t res_ref = 0;
6811 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6812 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6813 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6814 res_ref = (uint64_t)res_var.inner & ~1;
6817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6818 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6819 CHECK(!val->result_ok);
6820 LDKDecodeError err_var = (*val->contents.err);
6821 uint64_t err_ref = 0;
6822 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6823 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6824 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6825 err_ref = (uint64_t)err_var.inner & ~1;
6828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6829 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6830 CHECK(val->result_ok);
6831 LDKRevokeAndACK res_var = (*val->contents.result);
6832 uint64_t res_ref = 0;
6833 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6834 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6835 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6836 res_ref = (uint64_t)res_var.inner & ~1;
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6840 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6841 CHECK(!val->result_ok);
6842 LDKDecodeError err_var = (*val->contents.err);
6843 uint64_t err_ref = 0;
6844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6847 err_ref = (uint64_t)err_var.inner & ~1;
6850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6851 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6852 CHECK(val->result_ok);
6853 LDKShutdown res_var = (*val->contents.result);
6854 uint64_t res_ref = 0;
6855 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6856 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6857 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6858 res_ref = (uint64_t)res_var.inner & ~1;
6861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6862 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6863 CHECK(!val->result_ok);
6864 LDKDecodeError err_var = (*val->contents.err);
6865 uint64_t err_ref = 0;
6866 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6867 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6868 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6869 err_ref = (uint64_t)err_var.inner & ~1;
6872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6873 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6874 CHECK(val->result_ok);
6875 LDKUpdateFailHTLC res_var = (*val->contents.result);
6876 uint64_t res_ref = 0;
6877 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6878 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6879 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6880 res_ref = (uint64_t)res_var.inner & ~1;
6883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6884 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6885 CHECK(!val->result_ok);
6886 LDKDecodeError err_var = (*val->contents.err);
6887 uint64_t err_ref = 0;
6888 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6889 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6890 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6891 err_ref = (uint64_t)err_var.inner & ~1;
6894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6895 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6896 CHECK(val->result_ok);
6897 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6898 uint64_t res_ref = 0;
6899 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6900 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6901 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6902 res_ref = (uint64_t)res_var.inner & ~1;
6905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6906 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6907 CHECK(!val->result_ok);
6908 LDKDecodeError err_var = (*val->contents.err);
6909 uint64_t err_ref = 0;
6910 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6911 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6912 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6913 err_ref = (uint64_t)err_var.inner & ~1;
6916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6917 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6918 CHECK(val->result_ok);
6919 LDKUpdateFee res_var = (*val->contents.result);
6920 uint64_t res_ref = 0;
6921 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6922 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6923 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6924 res_ref = (uint64_t)res_var.inner & ~1;
6927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6928 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6929 CHECK(!val->result_ok);
6930 LDKDecodeError err_var = (*val->contents.err);
6931 uint64_t err_ref = 0;
6932 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6933 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6934 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6935 err_ref = (uint64_t)err_var.inner & ~1;
6938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6939 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6940 CHECK(val->result_ok);
6941 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6942 uint64_t res_ref = 0;
6943 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6944 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6945 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6946 res_ref = (uint64_t)res_var.inner & ~1;
6949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6950 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6951 CHECK(!val->result_ok);
6952 LDKDecodeError err_var = (*val->contents.err);
6953 uint64_t err_ref = 0;
6954 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6955 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6956 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6957 err_ref = (uint64_t)err_var.inner & ~1;
6960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6961 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6962 CHECK(val->result_ok);
6963 LDKUpdateAddHTLC res_var = (*val->contents.result);
6964 uint64_t res_ref = 0;
6965 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6966 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6967 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6968 res_ref = (uint64_t)res_var.inner & ~1;
6971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6972 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6973 CHECK(!val->result_ok);
6974 LDKDecodeError err_var = (*val->contents.err);
6975 uint64_t err_ref = 0;
6976 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6977 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6978 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
6979 err_ref = (uint64_t)err_var.inner & ~1;
6982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6983 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6984 CHECK(val->result_ok);
6985 LDKPing res_var = (*val->contents.result);
6986 uint64_t res_ref = 0;
6987 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6988 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6989 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
6990 res_ref = (uint64_t)res_var.inner & ~1;
6993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6994 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6995 CHECK(!val->result_ok);
6996 LDKDecodeError err_var = (*val->contents.err);
6997 uint64_t err_ref = 0;
6998 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6999 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7000 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7001 err_ref = (uint64_t)err_var.inner & ~1;
7004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7005 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
7006 CHECK(val->result_ok);
7007 LDKPong res_var = (*val->contents.result);
7008 uint64_t res_ref = 0;
7009 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7010 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7011 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7012 res_ref = (uint64_t)res_var.inner & ~1;
7015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7016 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
7017 CHECK(!val->result_ok);
7018 LDKDecodeError err_var = (*val->contents.err);
7019 uint64_t err_ref = 0;
7020 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7021 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7022 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7023 err_ref = (uint64_t)err_var.inner & ~1;
7026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7027 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7028 CHECK(val->result_ok);
7029 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
7030 uint64_t res_ref = 0;
7031 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7032 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7033 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7034 res_ref = (uint64_t)res_var.inner & ~1;
7037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7038 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7039 CHECK(!val->result_ok);
7040 LDKDecodeError err_var = (*val->contents.err);
7041 uint64_t err_ref = 0;
7042 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7043 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7044 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7045 err_ref = (uint64_t)err_var.inner & ~1;
7048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7049 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7050 CHECK(val->result_ok);
7051 LDKChannelAnnouncement res_var = (*val->contents.result);
7052 uint64_t res_ref = 0;
7053 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7054 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7055 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7056 res_ref = (uint64_t)res_var.inner & ~1;
7059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7060 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7061 CHECK(!val->result_ok);
7062 LDKDecodeError err_var = (*val->contents.err);
7063 uint64_t err_ref = 0;
7064 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7065 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7066 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7067 err_ref = (uint64_t)err_var.inner & ~1;
7070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7071 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7072 CHECK(val->result_ok);
7073 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
7074 uint64_t res_ref = 0;
7075 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7076 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7077 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7078 res_ref = (uint64_t)res_var.inner & ~1;
7081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7082 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7083 CHECK(!val->result_ok);
7084 LDKDecodeError err_var = (*val->contents.err);
7085 uint64_t err_ref = 0;
7086 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7087 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7088 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7089 err_ref = (uint64_t)err_var.inner & ~1;
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7093 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7094 CHECK(val->result_ok);
7095 LDKChannelUpdate res_var = (*val->contents.result);
7096 uint64_t res_ref = 0;
7097 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7098 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7099 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7100 res_ref = (uint64_t)res_var.inner & ~1;
7103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7104 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7105 CHECK(!val->result_ok);
7106 LDKDecodeError err_var = (*val->contents.err);
7107 uint64_t err_ref = 0;
7108 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7109 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7110 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7111 err_ref = (uint64_t)err_var.inner & ~1;
7114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7115 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7116 CHECK(val->result_ok);
7117 LDKErrorMessage res_var = (*val->contents.result);
7118 uint64_t res_ref = 0;
7119 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7120 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7121 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7122 res_ref = (uint64_t)res_var.inner & ~1;
7125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7126 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7127 CHECK(!val->result_ok);
7128 LDKDecodeError err_var = (*val->contents.err);
7129 uint64_t err_ref = 0;
7130 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7131 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7132 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7133 err_ref = (uint64_t)err_var.inner & ~1;
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7137 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7138 CHECK(val->result_ok);
7139 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
7140 uint64_t res_ref = 0;
7141 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7142 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7143 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7144 res_ref = (uint64_t)res_var.inner & ~1;
7147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7148 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7149 CHECK(!val->result_ok);
7150 LDKDecodeError err_var = (*val->contents.err);
7151 uint64_t err_ref = 0;
7152 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7153 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7154 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7155 err_ref = (uint64_t)err_var.inner & ~1;
7158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7159 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7160 CHECK(val->result_ok);
7161 LDKNodeAnnouncement res_var = (*val->contents.result);
7162 uint64_t res_ref = 0;
7163 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7164 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7165 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7166 res_ref = (uint64_t)res_var.inner & ~1;
7169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7170 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7171 CHECK(!val->result_ok);
7172 LDKDecodeError err_var = (*val->contents.err);
7173 uint64_t err_ref = 0;
7174 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7175 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7176 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7177 err_ref = (uint64_t)err_var.inner & ~1;
7180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7181 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7182 CHECK(val->result_ok);
7183 LDKQueryShortChannelIds res_var = (*val->contents.result);
7184 uint64_t res_ref = 0;
7185 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7186 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7187 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7188 res_ref = (uint64_t)res_var.inner & ~1;
7191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7192 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7193 CHECK(!val->result_ok);
7194 LDKDecodeError err_var = (*val->contents.err);
7195 uint64_t err_ref = 0;
7196 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7197 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7198 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7199 err_ref = (uint64_t)err_var.inner & ~1;
7202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7203 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7204 CHECK(val->result_ok);
7205 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
7206 uint64_t res_ref = 0;
7207 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7208 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7209 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7210 res_ref = (uint64_t)res_var.inner & ~1;
7213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7214 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7215 CHECK(!val->result_ok);
7216 LDKDecodeError err_var = (*val->contents.err);
7217 uint64_t err_ref = 0;
7218 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7219 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7220 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7221 err_ref = (uint64_t)err_var.inner & ~1;
7224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7225 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7226 CHECK(val->result_ok);
7227 LDKQueryChannelRange res_var = (*val->contents.result);
7228 uint64_t res_ref = 0;
7229 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7230 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7231 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7232 res_ref = (uint64_t)res_var.inner & ~1;
7235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7236 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7237 CHECK(!val->result_ok);
7238 LDKDecodeError err_var = (*val->contents.err);
7239 uint64_t err_ref = 0;
7240 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7241 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7242 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7243 err_ref = (uint64_t)err_var.inner & ~1;
7246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7247 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7248 CHECK(val->result_ok);
7249 LDKReplyChannelRange res_var = (*val->contents.result);
7250 uint64_t res_ref = 0;
7251 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7252 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7253 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7254 res_ref = (uint64_t)res_var.inner & ~1;
7257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7258 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7259 CHECK(!val->result_ok);
7260 LDKDecodeError err_var = (*val->contents.err);
7261 uint64_t err_ref = 0;
7262 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7263 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7264 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7265 err_ref = (uint64_t)err_var.inner & ~1;
7268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7269 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7270 CHECK(val->result_ok);
7271 LDKGossipTimestampFilter res_var = (*val->contents.result);
7272 uint64_t res_ref = 0;
7273 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7274 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7275 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7276 res_ref = (uint64_t)res_var.inner & ~1;
7279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7280 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7281 CHECK(!val->result_ok);
7282 LDKDecodeError err_var = (*val->contents.err);
7283 uint64_t err_ref = 0;
7284 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7285 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7286 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
7287 err_ref = (uint64_t)err_var.inner & ~1;
7290 static jclass LDKSignOrCreationError_SignError_class = NULL;
7291 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
7292 static jclass LDKSignOrCreationError_CreationError_class = NULL;
7293 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
7295 LDKSignOrCreationError_SignError_class =
7296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
7297 CHECK(LDKSignOrCreationError_SignError_class != NULL);
7298 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
7299 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
7300 LDKSignOrCreationError_CreationError_class =
7301 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
7302 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
7303 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
7304 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
7306 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7307 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7309 case LDKSignOrCreationError_SignError: {
7310 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
7312 case LDKSignOrCreationError_CreationError: {
7313 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
7314 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
7319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7320 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7321 CHECK(val->result_ok);
7322 LDKInvoice res_var = (*val->contents.result);
7323 uint64_t res_ref = 0;
7324 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7325 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7326 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7327 res_ref = (uint64_t)res_var.inner & ~1;
7330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7331 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7332 CHECK(!val->result_ok);
7333 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
7336 typedef struct LDKFilter_JCalls {
7337 atomic_size_t refcnt;
7340 jmethodID register_tx_meth;
7341 jmethodID register_output_meth;
7343 static void LDKFilter_JCalls_free(void* this_arg) {
7344 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7345 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7347 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7348 if (get_jenv_res == JNI_EDETACHED) {
7349 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7351 DO_ASSERT(get_jenv_res == JNI_OK);
7353 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7354 if (get_jenv_res == JNI_EDETACHED) {
7355 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7360 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7361 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7363 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7364 if (get_jenv_res == JNI_EDETACHED) {
7365 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7367 DO_ASSERT(get_jenv_res == JNI_OK);
7369 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7370 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7371 LDKu8slice script_pubkey_var = script_pubkey;
7372 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
7373 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
7374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7376 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
7377 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7378 (*env)->ExceptionDescribe(env);
7379 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
7381 if (get_jenv_res == JNI_EDETACHED) {
7382 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7385 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7386 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7389 if (get_jenv_res == JNI_EDETACHED) {
7390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7392 DO_ASSERT(get_jenv_res == JNI_OK);
7394 LDKWatchedOutput output_var = output;
7395 uint64_t output_ref = 0;
7396 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7397 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7398 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7399 output_ref = (uint64_t)output_var.inner;
7400 if (output_var.is_owned) {
7403 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7405 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7406 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7407 (*env)->ExceptionDescribe(env);
7408 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7410 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7411 CHECK_ACCESS(ret_ptr);
7412 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7414 if (get_jenv_res == JNI_EDETACHED) {
7415 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7419 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7420 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7421 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7423 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7424 jclass c = (*env)->GetObjectClass(env, o);
7426 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7427 atomic_init(&calls->refcnt, 1);
7428 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7429 calls->o = (*env)->NewWeakGlobalRef(env, o);
7430 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7431 CHECK(calls->register_tx_meth != NULL);
7432 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7433 CHECK(calls->register_output_meth != NULL);
7436 .this_arg = (void*) calls,
7437 .register_tx = register_tx_LDKFilter_jcall,
7438 .register_output = register_output_LDKFilter_jcall,
7439 .free = LDKFilter_JCalls_free,
7443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7444 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7445 *res_ptr = LDKFilter_init(env, clz, o);
7446 return (uint64_t)res_ptr;
7448 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) {
7449 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7450 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7451 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7452 unsigned char txid_arr[32];
7453 CHECK((*env)->GetArrayLength(env, txid) == 32);
7454 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7455 unsigned char (*txid_ref)[32] = &txid_arr;
7456 LDKu8slice script_pubkey_ref;
7457 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7458 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7459 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7460 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7464 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7465 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7466 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7467 LDKWatchedOutput output_conv;
7468 output_conv.inner = (void*)(output & (~1));
7469 output_conv.is_owned = (output & 1) || (output == 0);
7470 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7471 output_conv = WatchedOutput_clone(&output_conv);
7472 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7473 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7474 uint64_t ret_ref = (uint64_t)ret_copy;
7478 static jclass LDKCOption_FilterZ_Some_class = NULL;
7479 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7480 static jclass LDKCOption_FilterZ_None_class = NULL;
7481 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7483 LDKCOption_FilterZ_Some_class =
7484 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
7485 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7486 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7487 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7488 LDKCOption_FilterZ_None_class =
7489 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
7490 CHECK(LDKCOption_FilterZ_None_class != NULL);
7491 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7492 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7495 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7497 case LDKCOption_FilterZ_Some: {
7498 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7499 *some_ret = obj->some;
7500 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7501 if ((*some_ret).free == LDKFilter_JCalls_free) {
7502 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7503 LDKFilter_JCalls_cloned(&(*some_ret));
7505 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7507 case LDKCOption_FilterZ_None: {
7508 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7514 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7515 CHECK(val->result_ok);
7516 LDKLockedChannelMonitor res_var = (*val->contents.result);
7517 uint64_t res_ref = 0;
7518 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7519 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7520 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
7521 res_ref = (uint64_t)res_var.inner & ~1;
7524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7525 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7526 CHECK(!val->result_ok);
7527 return *val->contents.err;
7529 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7530 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7531 for (size_t i = 0; i < ret.datalen; i++) {
7532 ret.data[i] = OutPoint_clone(&orig->data[i]);
7536 typedef struct LDKMessageSendEventsProvider_JCalls {
7537 atomic_size_t refcnt;
7540 jmethodID get_and_clear_pending_msg_events_meth;
7541 } LDKMessageSendEventsProvider_JCalls;
7542 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7543 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7544 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7546 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7547 if (get_jenv_res == JNI_EDETACHED) {
7548 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7550 DO_ASSERT(get_jenv_res == JNI_OK);
7552 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7553 if (get_jenv_res == JNI_EDETACHED) {
7554 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7559 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7560 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7563 if (get_jenv_res == JNI_EDETACHED) {
7564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7566 DO_ASSERT(get_jenv_res == JNI_OK);
7568 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7570 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7571 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7572 (*env)->ExceptionDescribe(env);
7573 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7575 LDKCVec_MessageSendEventZ ret_constr;
7576 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7577 if (ret_constr.datalen > 0)
7578 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7580 ret_constr.data = NULL;
7581 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7582 for (size_t s = 0; s < ret_constr.datalen; s++) {
7583 int64_t ret_conv_18 = ret_vals[s];
7584 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
7585 CHECK_ACCESS(ret_conv_18_ptr);
7586 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7587 FREE((void*)ret_conv_18);
7588 ret_constr.data[s] = ret_conv_18_conv;
7590 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7591 if (get_jenv_res == JNI_EDETACHED) {
7592 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7596 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7597 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7598 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7600 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7601 jclass c = (*env)->GetObjectClass(env, o);
7603 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7604 atomic_init(&calls->refcnt, 1);
7605 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7606 calls->o = (*env)->NewWeakGlobalRef(env, o);
7607 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7608 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7610 LDKMessageSendEventsProvider ret = {
7611 .this_arg = (void*) calls,
7612 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7613 .free = LDKMessageSendEventsProvider_JCalls_free,
7617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7618 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7619 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7620 return (uint64_t)res_ptr;
7622 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7623 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7624 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7625 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7626 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7627 int64_tArray ret_arr = NULL;
7628 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7629 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7630 for (size_t s = 0; s < ret_var.datalen; s++) {
7631 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7632 *ret_conv_18_copy = ret_var.data[s];
7633 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7634 ret_arr_ptr[s] = ret_conv_18_ref;
7636 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7641 typedef struct LDKEventHandler_JCalls {
7642 atomic_size_t refcnt;
7645 jmethodID handle_event_meth;
7646 } LDKEventHandler_JCalls;
7647 static void LDKEventHandler_JCalls_free(void* this_arg) {
7648 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7649 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7651 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7652 if (get_jenv_res == JNI_EDETACHED) {
7653 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7655 DO_ASSERT(get_jenv_res == JNI_OK);
7657 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7658 if (get_jenv_res == JNI_EDETACHED) {
7659 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7664 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7665 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7667 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7668 if (get_jenv_res == JNI_EDETACHED) {
7669 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7671 DO_ASSERT(get_jenv_res == JNI_OK);
7673 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7674 *ret_event = Event_clone(event);
7675 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7677 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7678 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7679 (*env)->ExceptionDescribe(env);
7680 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7682 if (get_jenv_res == JNI_EDETACHED) {
7683 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7686 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7687 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7688 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7690 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7691 jclass c = (*env)->GetObjectClass(env, o);
7693 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7694 atomic_init(&calls->refcnt, 1);
7695 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7696 calls->o = (*env)->NewWeakGlobalRef(env, o);
7697 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7698 CHECK(calls->handle_event_meth != NULL);
7700 LDKEventHandler ret = {
7701 .this_arg = (void*) calls,
7702 .handle_event = handle_event_LDKEventHandler_jcall,
7703 .free = LDKEventHandler_JCalls_free,
7707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7708 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7709 *res_ptr = LDKEventHandler_init(env, clz, o);
7710 return (uint64_t)res_ptr;
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7713 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7714 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7715 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
7716 LDKEvent* event_conv = (LDKEvent*)event;
7717 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7720 typedef struct LDKEventsProvider_JCalls {
7721 atomic_size_t refcnt;
7724 jmethodID process_pending_events_meth;
7725 } LDKEventsProvider_JCalls;
7726 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7727 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7728 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7730 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7731 if (get_jenv_res == JNI_EDETACHED) {
7732 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7734 DO_ASSERT(get_jenv_res == JNI_OK);
7736 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7737 if (get_jenv_res == JNI_EDETACHED) {
7738 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7743 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7744 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7746 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7747 if (get_jenv_res == JNI_EDETACHED) {
7748 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7750 DO_ASSERT(get_jenv_res == JNI_OK);
7752 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7753 *handler_ret = handler;
7754 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7756 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7757 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7758 (*env)->ExceptionDescribe(env);
7759 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7761 if (get_jenv_res == JNI_EDETACHED) {
7762 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7765 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7766 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7767 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7769 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7770 jclass c = (*env)->GetObjectClass(env, o);
7772 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7773 atomic_init(&calls->refcnt, 1);
7774 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7775 calls->o = (*env)->NewWeakGlobalRef(env, o);
7776 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7777 CHECK(calls->process_pending_events_meth != NULL);
7779 LDKEventsProvider ret = {
7780 .this_arg = (void*) calls,
7781 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7782 .free = LDKEventsProvider_JCalls_free,
7786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7787 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7788 *res_ptr = LDKEventsProvider_init(env, clz, o);
7789 return (uint64_t)res_ptr;
7791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7792 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7793 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7794 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
7795 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
7796 CHECK_ACCESS(handler_ptr);
7797 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
7798 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7799 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7800 LDKEventHandler_JCalls_cloned(&handler_conv);
7802 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7805 typedef struct LDKListen_JCalls {
7806 atomic_size_t refcnt;
7809 jmethodID block_connected_meth;
7810 jmethodID block_disconnected_meth;
7812 static void LDKListen_JCalls_free(void* this_arg) {
7813 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7814 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7816 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7817 if (get_jenv_res == JNI_EDETACHED) {
7818 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7820 DO_ASSERT(get_jenv_res == JNI_OK);
7822 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7823 if (get_jenv_res == JNI_EDETACHED) {
7824 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7829 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7830 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7832 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7833 if (get_jenv_res == JNI_EDETACHED) {
7834 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7836 DO_ASSERT(get_jenv_res == JNI_OK);
7838 LDKu8slice block_var = block;
7839 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7840 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7841 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7843 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7844 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7845 (*env)->ExceptionDescribe(env);
7846 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
7848 if (get_jenv_res == JNI_EDETACHED) {
7849 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7852 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7853 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7855 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7856 if (get_jenv_res == JNI_EDETACHED) {
7857 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7859 DO_ASSERT(get_jenv_res == JNI_OK);
7861 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7862 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7863 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7865 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7866 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7867 (*env)->ExceptionDescribe(env);
7868 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7870 if (get_jenv_res == JNI_EDETACHED) {
7871 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7874 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7875 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7876 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7878 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7879 jclass c = (*env)->GetObjectClass(env, o);
7881 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7882 atomic_init(&calls->refcnt, 1);
7883 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7884 calls->o = (*env)->NewWeakGlobalRef(env, o);
7885 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7886 CHECK(calls->block_connected_meth != NULL);
7887 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7888 CHECK(calls->block_disconnected_meth != NULL);
7891 .this_arg = (void*) calls,
7892 .block_connected = block_connected_LDKListen_jcall,
7893 .block_disconnected = block_disconnected_LDKListen_jcall,
7894 .free = LDKListen_JCalls_free,
7898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7899 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7900 *res_ptr = LDKListen_init(env, clz, o);
7901 return (uint64_t)res_ptr;
7903 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) {
7904 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7905 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7906 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7907 LDKu8slice block_ref;
7908 block_ref.datalen = (*env)->GetArrayLength(env, block);
7909 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7910 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7911 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7914 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) {
7915 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7916 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7917 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7918 unsigned char header_arr[80];
7919 CHECK((*env)->GetArrayLength(env, header) == 80);
7920 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7921 unsigned char (*header_ref)[80] = &header_arr;
7922 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7925 typedef struct LDKConfirm_JCalls {
7926 atomic_size_t refcnt;
7929 jmethodID transactions_confirmed_meth;
7930 jmethodID transaction_unconfirmed_meth;
7931 jmethodID best_block_updated_meth;
7932 jmethodID get_relevant_txids_meth;
7933 } LDKConfirm_JCalls;
7934 static void LDKConfirm_JCalls_free(void* this_arg) {
7935 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7936 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7938 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7939 if (get_jenv_res == JNI_EDETACHED) {
7940 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7942 DO_ASSERT(get_jenv_res == JNI_OK);
7944 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7945 if (get_jenv_res == JNI_EDETACHED) {
7946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7951 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7952 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7954 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7955 if (get_jenv_res == JNI_EDETACHED) {
7956 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7958 DO_ASSERT(get_jenv_res == JNI_OK);
7960 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7961 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7962 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7963 int64_tArray txdata_arr = NULL;
7964 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7965 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7966 for (size_t c = 0; c < txdata_var.datalen; c++) {
7967 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7968 *txdata_conv_28_conv = txdata_var.data[c];
7969 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7971 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7972 FREE(txdata_var.data);
7973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7975 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7976 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7977 (*env)->ExceptionDescribe(env);
7978 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7980 if (get_jenv_res == JNI_EDETACHED) {
7981 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7984 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7985 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7987 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7988 if (get_jenv_res == JNI_EDETACHED) {
7989 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7991 DO_ASSERT(get_jenv_res == JNI_OK);
7993 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7994 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7995 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7997 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7998 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7999 (*env)->ExceptionDescribe(env);
8000 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
8002 if (get_jenv_res == JNI_EDETACHED) {
8003 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8006 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8007 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8009 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8010 if (get_jenv_res == JNI_EDETACHED) {
8011 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8013 DO_ASSERT(get_jenv_res == JNI_OK);
8015 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
8016 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
8017 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8019 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
8020 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8021 (*env)->ExceptionDescribe(env);
8022 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
8024 if (get_jenv_res == JNI_EDETACHED) {
8025 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8028 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8029 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8031 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8032 if (get_jenv_res == JNI_EDETACHED) {
8033 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8035 DO_ASSERT(get_jenv_res == JNI_OK);
8037 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8039 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
8040 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8041 (*env)->ExceptionDescribe(env);
8042 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
8044 LDKCVec_TxidZ ret_constr;
8045 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8046 if (ret_constr.datalen > 0)
8047 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8049 ret_constr.data = NULL;
8050 for (size_t i = 0; i < ret_constr.datalen; i++) {
8051 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
8052 LDKThirtyTwoBytes ret_conv_8_ref;
8053 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
8054 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
8055 ret_constr.data[i] = ret_conv_8_ref;
8057 if (get_jenv_res == JNI_EDETACHED) {
8058 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8062 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8063 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8064 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8066 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
8067 jclass c = (*env)->GetObjectClass(env, o);
8069 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8070 atomic_init(&calls->refcnt, 1);
8071 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8072 calls->o = (*env)->NewWeakGlobalRef(env, o);
8073 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
8074 CHECK(calls->transactions_confirmed_meth != NULL);
8075 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
8076 CHECK(calls->transaction_unconfirmed_meth != NULL);
8077 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
8078 CHECK(calls->best_block_updated_meth != NULL);
8079 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
8080 CHECK(calls->get_relevant_txids_meth != NULL);
8083 .this_arg = (void*) calls,
8084 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8085 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8086 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8087 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8088 .free = LDKConfirm_JCalls_free,
8092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
8093 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8094 *res_ptr = LDKConfirm_init(env, clz, o);
8095 return (uint64_t)res_ptr;
8097 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) {
8098 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8099 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8100 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8101 unsigned char header_arr[80];
8102 CHECK((*env)->GetArrayLength(env, header) == 80);
8103 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8104 unsigned char (*header_ref)[80] = &header_arr;
8105 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8106 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8107 if (txdata_constr.datalen > 0)
8108 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8110 txdata_constr.data = NULL;
8111 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8112 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8113 int64_t txdata_conv_28 = txdata_vals[c];
8114 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
8115 CHECK_ACCESS(txdata_conv_28_ptr);
8116 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8117 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
8118 txdata_constr.data[c] = txdata_conv_28_conv;
8120 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8121 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
8125 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8126 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8127 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8128 unsigned char txid_arr[32];
8129 CHECK((*env)->GetArrayLength(env, txid) == 32);
8130 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
8131 unsigned char (*txid_ref)[32] = &txid_arr;
8132 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8135 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) {
8136 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8137 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8138 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8139 unsigned char header_arr[80];
8140 CHECK((*env)->GetArrayLength(env, header) == 80);
8141 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8142 unsigned char (*header_ref)[80] = &header_arr;
8143 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8146 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
8147 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8148 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8149 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8150 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8151 jobjectArray ret_arr = NULL;
8152 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8154 for (size_t i = 0; i < ret_var.datalen; i++) {
8155 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
8156 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
8157 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
8164 typedef struct LDKPersist_JCalls {
8165 atomic_size_t refcnt;
8168 jmethodID persist_new_channel_meth;
8169 jmethodID update_persisted_channel_meth;
8170 } LDKPersist_JCalls;
8171 static void LDKPersist_JCalls_free(void* this_arg) {
8172 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8173 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8175 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8176 if (get_jenv_res == JNI_EDETACHED) {
8177 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8179 DO_ASSERT(get_jenv_res == JNI_OK);
8181 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8182 if (get_jenv_res == JNI_EDETACHED) {
8183 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8188 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8189 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8191 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8192 if (get_jenv_res == JNI_EDETACHED) {
8193 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8195 DO_ASSERT(get_jenv_res == JNI_OK);
8197 LDKOutPoint channel_id_var = channel_id;
8198 uint64_t channel_id_ref = 0;
8199 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8200 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8201 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8202 channel_id_ref = (uint64_t)channel_id_var.inner;
8203 if (channel_id_var.is_owned) {
8204 channel_id_ref |= 1;
8206 LDKChannelMonitor data_var = *data;
8207 uint64_t data_ref = 0;
8208 data_var = ChannelMonitor_clone(data);
8209 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8210 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8211 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8212 data_ref = (uint64_t)data_var.inner;
8213 if (data_var.is_owned) {
8216 LDKMonitorUpdateId update_id_var = update_id;
8217 uint64_t update_id_ref = 0;
8218 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8219 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8220 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8221 update_id_ref = (uint64_t)update_id_var.inner;
8222 if (update_id_var.is_owned) {
8225 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8227 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
8228 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8229 (*env)->ExceptionDescribe(env);
8230 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
8232 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8233 CHECK_ACCESS(ret_ptr);
8234 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8236 if (get_jenv_res == JNI_EDETACHED) {
8237 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8241 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8242 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8244 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8245 if (get_jenv_res == JNI_EDETACHED) {
8246 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8248 DO_ASSERT(get_jenv_res == JNI_OK);
8250 LDKOutPoint channel_id_var = channel_id;
8251 uint64_t channel_id_ref = 0;
8252 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8253 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8254 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8255 channel_id_ref = (uint64_t)channel_id_var.inner;
8256 if (channel_id_var.is_owned) {
8257 channel_id_ref |= 1;
8259 LDKChannelMonitorUpdate update_var = *update;
8260 uint64_t update_ref = 0;
8261 if ((uint64_t)update_var.inner > 4096) {
8262 update_var = ChannelMonitorUpdate_clone(update);
8263 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8264 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8265 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8266 update_ref = (uint64_t)update_var.inner;
8267 if (update_var.is_owned) {
8271 LDKChannelMonitor data_var = *data;
8272 uint64_t data_ref = 0;
8273 data_var = ChannelMonitor_clone(data);
8274 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8275 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8276 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8277 data_ref = (uint64_t)data_var.inner;
8278 if (data_var.is_owned) {
8281 LDKMonitorUpdateId update_id_var = update_id;
8282 uint64_t update_id_ref = 0;
8283 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8284 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8285 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8286 update_id_ref = (uint64_t)update_id_var.inner;
8287 if (update_id_var.is_owned) {
8290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8292 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
8293 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8294 (*env)->ExceptionDescribe(env);
8295 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
8297 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8298 CHECK_ACCESS(ret_ptr);
8299 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8301 if (get_jenv_res == JNI_EDETACHED) {
8302 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8306 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8307 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8308 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8310 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
8311 jclass c = (*env)->GetObjectClass(env, o);
8313 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8314 atomic_init(&calls->refcnt, 1);
8315 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8316 calls->o = (*env)->NewWeakGlobalRef(env, o);
8317 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
8318 CHECK(calls->persist_new_channel_meth != NULL);
8319 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
8320 CHECK(calls->update_persisted_channel_meth != NULL);
8323 .this_arg = (void*) calls,
8324 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8325 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8326 .free = LDKPersist_JCalls_free,
8330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
8331 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8332 *res_ptr = LDKPersist_init(env, clz, o);
8333 return (uint64_t)res_ptr;
8335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
8336 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8337 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8338 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8339 LDKOutPoint channel_id_conv;
8340 channel_id_conv.inner = (void*)(channel_id & (~1));
8341 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8342 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8343 channel_id_conv = OutPoint_clone(&channel_id_conv);
8344 LDKChannelMonitor data_conv;
8345 data_conv.inner = (void*)(data & (~1));
8346 data_conv.is_owned = false;
8347 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8348 LDKMonitorUpdateId update_id_conv;
8349 update_id_conv.inner = (void*)(update_id & (~1));
8350 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8351 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8352 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8353 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8354 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8355 return (uint64_t)ret_conv;
8358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
8359 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8360 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8361 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8362 LDKOutPoint channel_id_conv;
8363 channel_id_conv.inner = (void*)(channel_id & (~1));
8364 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8365 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8366 channel_id_conv = OutPoint_clone(&channel_id_conv);
8367 LDKChannelMonitorUpdate update_conv;
8368 update_conv.inner = (void*)(update & (~1));
8369 update_conv.is_owned = false;
8370 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8371 LDKChannelMonitor data_conv;
8372 data_conv.inner = (void*)(data & (~1));
8373 data_conv.is_owned = false;
8374 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8375 LDKMonitorUpdateId update_id_conv;
8376 update_id_conv.inner = (void*)(update_id & (~1));
8377 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8378 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8379 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8380 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8381 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8382 return (uint64_t)ret_conv;
8385 typedef struct LDKChannelMessageHandler_JCalls {
8386 atomic_size_t refcnt;
8389 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8390 jmethodID handle_open_channel_meth;
8391 jmethodID handle_accept_channel_meth;
8392 jmethodID handle_funding_created_meth;
8393 jmethodID handle_funding_signed_meth;
8394 jmethodID handle_funding_locked_meth;
8395 jmethodID handle_shutdown_meth;
8396 jmethodID handle_closing_signed_meth;
8397 jmethodID handle_update_add_htlc_meth;
8398 jmethodID handle_update_fulfill_htlc_meth;
8399 jmethodID handle_update_fail_htlc_meth;
8400 jmethodID handle_update_fail_malformed_htlc_meth;
8401 jmethodID handle_commitment_signed_meth;
8402 jmethodID handle_revoke_and_ack_meth;
8403 jmethodID handle_update_fee_meth;
8404 jmethodID handle_announcement_signatures_meth;
8405 jmethodID peer_disconnected_meth;
8406 jmethodID peer_connected_meth;
8407 jmethodID handle_channel_reestablish_meth;
8408 jmethodID handle_channel_update_meth;
8409 jmethodID handle_error_meth;
8410 } LDKChannelMessageHandler_JCalls;
8411 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8412 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8413 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8415 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8416 if (get_jenv_res == JNI_EDETACHED) {
8417 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8419 DO_ASSERT(get_jenv_res == JNI_OK);
8421 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8422 if (get_jenv_res == JNI_EDETACHED) {
8423 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8428 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8429 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8431 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8432 if (get_jenv_res == JNI_EDETACHED) {
8433 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8435 DO_ASSERT(get_jenv_res == JNI_OK);
8437 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8438 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8439 LDKInitFeatures their_features_var = their_features;
8440 uint64_t their_features_ref = 0;
8441 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8442 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8443 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8444 their_features_ref = (uint64_t)their_features_var.inner;
8445 if (their_features_var.is_owned) {
8446 their_features_ref |= 1;
8448 LDKOpenChannel msg_var = *msg;
8449 uint64_t msg_ref = 0;
8450 msg_var = OpenChannel_clone(msg);
8451 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8452 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8453 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8454 msg_ref = (uint64_t)msg_var.inner;
8455 if (msg_var.is_owned) {
8458 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8460 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8461 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8462 (*env)->ExceptionDescribe(env);
8463 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
8465 if (get_jenv_res == JNI_EDETACHED) {
8466 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8469 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8470 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8472 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8473 if (get_jenv_res == JNI_EDETACHED) {
8474 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8476 DO_ASSERT(get_jenv_res == JNI_OK);
8478 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8479 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8480 LDKInitFeatures their_features_var = their_features;
8481 uint64_t their_features_ref = 0;
8482 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8483 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8484 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8485 their_features_ref = (uint64_t)their_features_var.inner;
8486 if (their_features_var.is_owned) {
8487 their_features_ref |= 1;
8489 LDKAcceptChannel msg_var = *msg;
8490 uint64_t msg_ref = 0;
8491 msg_var = AcceptChannel_clone(msg);
8492 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8493 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8495 msg_ref = (uint64_t)msg_var.inner;
8496 if (msg_var.is_owned) {
8499 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8501 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8502 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8503 (*env)->ExceptionDescribe(env);
8504 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
8506 if (get_jenv_res == JNI_EDETACHED) {
8507 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8510 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8511 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8513 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8514 if (get_jenv_res == JNI_EDETACHED) {
8515 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8517 DO_ASSERT(get_jenv_res == JNI_OK);
8519 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8520 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8521 LDKFundingCreated msg_var = *msg;
8522 uint64_t msg_ref = 0;
8523 msg_var = FundingCreated_clone(msg);
8524 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8525 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8526 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8527 msg_ref = (uint64_t)msg_var.inner;
8528 if (msg_var.is_owned) {
8531 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8533 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8534 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8535 (*env)->ExceptionDescribe(env);
8536 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8538 if (get_jenv_res == JNI_EDETACHED) {
8539 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8542 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8543 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8545 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8546 if (get_jenv_res == JNI_EDETACHED) {
8547 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8549 DO_ASSERT(get_jenv_res == JNI_OK);
8551 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8552 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8553 LDKFundingSigned msg_var = *msg;
8554 uint64_t msg_ref = 0;
8555 msg_var = FundingSigned_clone(msg);
8556 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8557 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8558 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8559 msg_ref = (uint64_t)msg_var.inner;
8560 if (msg_var.is_owned) {
8563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8565 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8566 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8567 (*env)->ExceptionDescribe(env);
8568 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8570 if (get_jenv_res == JNI_EDETACHED) {
8571 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8574 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8575 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8577 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8578 if (get_jenv_res == JNI_EDETACHED) {
8579 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8581 DO_ASSERT(get_jenv_res == JNI_OK);
8583 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8584 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8585 LDKFundingLocked msg_var = *msg;
8586 uint64_t msg_ref = 0;
8587 msg_var = FundingLocked_clone(msg);
8588 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8589 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8591 msg_ref = (uint64_t)msg_var.inner;
8592 if (msg_var.is_owned) {
8595 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8597 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8598 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8599 (*env)->ExceptionDescribe(env);
8600 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8602 if (get_jenv_res == JNI_EDETACHED) {
8603 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8606 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8607 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8609 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8610 if (get_jenv_res == JNI_EDETACHED) {
8611 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8613 DO_ASSERT(get_jenv_res == JNI_OK);
8615 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8616 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8617 LDKInitFeatures their_features_var = *their_features;
8618 uint64_t their_features_ref = 0;
8619 their_features_var = InitFeatures_clone(their_features);
8620 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8621 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8622 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8623 their_features_ref = (uint64_t)their_features_var.inner;
8624 if (their_features_var.is_owned) {
8625 their_features_ref |= 1;
8627 LDKShutdown msg_var = *msg;
8628 uint64_t msg_ref = 0;
8629 msg_var = Shutdown_clone(msg);
8630 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8631 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8632 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8633 msg_ref = (uint64_t)msg_var.inner;
8634 if (msg_var.is_owned) {
8637 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8639 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8640 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8641 (*env)->ExceptionDescribe(env);
8642 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8644 if (get_jenv_res == JNI_EDETACHED) {
8645 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8648 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8649 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8651 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8652 if (get_jenv_res == JNI_EDETACHED) {
8653 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8655 DO_ASSERT(get_jenv_res == JNI_OK);
8657 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8658 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8659 LDKClosingSigned msg_var = *msg;
8660 uint64_t msg_ref = 0;
8661 msg_var = ClosingSigned_clone(msg);
8662 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8663 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8665 msg_ref = (uint64_t)msg_var.inner;
8666 if (msg_var.is_owned) {
8669 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8671 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8672 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8673 (*env)->ExceptionDescribe(env);
8674 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8676 if (get_jenv_res == JNI_EDETACHED) {
8677 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8680 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8681 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8683 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8684 if (get_jenv_res == JNI_EDETACHED) {
8685 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8687 DO_ASSERT(get_jenv_res == JNI_OK);
8689 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8690 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8691 LDKUpdateAddHTLC msg_var = *msg;
8692 uint64_t msg_ref = 0;
8693 msg_var = UpdateAddHTLC_clone(msg);
8694 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8695 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8696 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8697 msg_ref = (uint64_t)msg_var.inner;
8698 if (msg_var.is_owned) {
8701 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8703 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8704 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8705 (*env)->ExceptionDescribe(env);
8706 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8708 if (get_jenv_res == JNI_EDETACHED) {
8709 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8712 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8713 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8715 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8716 if (get_jenv_res == JNI_EDETACHED) {
8717 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8719 DO_ASSERT(get_jenv_res == JNI_OK);
8721 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8722 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8723 LDKUpdateFulfillHTLC msg_var = *msg;
8724 uint64_t msg_ref = 0;
8725 msg_var = UpdateFulfillHTLC_clone(msg);
8726 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8727 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8728 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8729 msg_ref = (uint64_t)msg_var.inner;
8730 if (msg_var.is_owned) {
8733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8735 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8736 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8737 (*env)->ExceptionDescribe(env);
8738 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8740 if (get_jenv_res == JNI_EDETACHED) {
8741 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8744 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8745 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8747 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8748 if (get_jenv_res == JNI_EDETACHED) {
8749 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8751 DO_ASSERT(get_jenv_res == JNI_OK);
8753 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8754 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8755 LDKUpdateFailHTLC msg_var = *msg;
8756 uint64_t msg_ref = 0;
8757 msg_var = UpdateFailHTLC_clone(msg);
8758 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8759 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8760 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8761 msg_ref = (uint64_t)msg_var.inner;
8762 if (msg_var.is_owned) {
8765 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8767 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8768 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8769 (*env)->ExceptionDescribe(env);
8770 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8772 if (get_jenv_res == JNI_EDETACHED) {
8773 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8776 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8777 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8779 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8780 if (get_jenv_res == JNI_EDETACHED) {
8781 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8783 DO_ASSERT(get_jenv_res == JNI_OK);
8785 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8786 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8787 LDKUpdateFailMalformedHTLC msg_var = *msg;
8788 uint64_t msg_ref = 0;
8789 msg_var = UpdateFailMalformedHTLC_clone(msg);
8790 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8791 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8792 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8793 msg_ref = (uint64_t)msg_var.inner;
8794 if (msg_var.is_owned) {
8797 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8799 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8800 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8801 (*env)->ExceptionDescribe(env);
8802 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8804 if (get_jenv_res == JNI_EDETACHED) {
8805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8808 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8809 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8811 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8812 if (get_jenv_res == JNI_EDETACHED) {
8813 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8815 DO_ASSERT(get_jenv_res == JNI_OK);
8817 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8818 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8819 LDKCommitmentSigned msg_var = *msg;
8820 uint64_t msg_ref = 0;
8821 msg_var = CommitmentSigned_clone(msg);
8822 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8823 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8824 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8825 msg_ref = (uint64_t)msg_var.inner;
8826 if (msg_var.is_owned) {
8829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8831 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8832 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8833 (*env)->ExceptionDescribe(env);
8834 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8836 if (get_jenv_res == JNI_EDETACHED) {
8837 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8840 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8841 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8843 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8844 if (get_jenv_res == JNI_EDETACHED) {
8845 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8847 DO_ASSERT(get_jenv_res == JNI_OK);
8849 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8850 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8851 LDKRevokeAndACK msg_var = *msg;
8852 uint64_t msg_ref = 0;
8853 msg_var = RevokeAndACK_clone(msg);
8854 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8855 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8856 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8857 msg_ref = (uint64_t)msg_var.inner;
8858 if (msg_var.is_owned) {
8861 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8863 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8864 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8865 (*env)->ExceptionDescribe(env);
8866 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8868 if (get_jenv_res == JNI_EDETACHED) {
8869 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8872 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8873 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8875 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8876 if (get_jenv_res == JNI_EDETACHED) {
8877 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8879 DO_ASSERT(get_jenv_res == JNI_OK);
8881 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8882 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8883 LDKUpdateFee msg_var = *msg;
8884 uint64_t msg_ref = 0;
8885 msg_var = UpdateFee_clone(msg);
8886 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8887 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8888 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8889 msg_ref = (uint64_t)msg_var.inner;
8890 if (msg_var.is_owned) {
8893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8895 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8896 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8897 (*env)->ExceptionDescribe(env);
8898 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8900 if (get_jenv_res == JNI_EDETACHED) {
8901 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8904 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8905 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8907 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8908 if (get_jenv_res == JNI_EDETACHED) {
8909 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8911 DO_ASSERT(get_jenv_res == JNI_OK);
8913 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8914 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8915 LDKAnnouncementSignatures msg_var = *msg;
8916 uint64_t msg_ref = 0;
8917 msg_var = AnnouncementSignatures_clone(msg);
8918 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8919 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8920 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8921 msg_ref = (uint64_t)msg_var.inner;
8922 if (msg_var.is_owned) {
8925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8927 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8928 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8929 (*env)->ExceptionDescribe(env);
8930 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8932 if (get_jenv_res == JNI_EDETACHED) {
8933 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8936 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8937 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8940 if (get_jenv_res == JNI_EDETACHED) {
8941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8943 DO_ASSERT(get_jenv_res == JNI_OK);
8945 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8946 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8949 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8950 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8951 (*env)->ExceptionDescribe(env);
8952 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8954 if (get_jenv_res == JNI_EDETACHED) {
8955 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8958 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8959 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8961 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8962 if (get_jenv_res == JNI_EDETACHED) {
8963 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8965 DO_ASSERT(get_jenv_res == JNI_OK);
8967 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8968 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8969 LDKInit msg_var = *msg;
8970 uint64_t msg_ref = 0;
8971 msg_var = Init_clone(msg);
8972 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8973 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8974 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8975 msg_ref = (uint64_t)msg_var.inner;
8976 if (msg_var.is_owned) {
8979 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8981 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8982 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8983 (*env)->ExceptionDescribe(env);
8984 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8986 if (get_jenv_res == JNI_EDETACHED) {
8987 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8990 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8991 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8993 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8994 if (get_jenv_res == JNI_EDETACHED) {
8995 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8997 DO_ASSERT(get_jenv_res == JNI_OK);
8999 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9000 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9001 LDKChannelReestablish msg_var = *msg;
9002 uint64_t msg_ref = 0;
9003 msg_var = ChannelReestablish_clone(msg);
9004 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9005 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9006 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9007 msg_ref = (uint64_t)msg_var.inner;
9008 if (msg_var.is_owned) {
9011 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9013 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
9014 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9015 (*env)->ExceptionDescribe(env);
9016 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
9018 if (get_jenv_res == JNI_EDETACHED) {
9019 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9022 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9023 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9025 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9026 if (get_jenv_res == JNI_EDETACHED) {
9027 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9029 DO_ASSERT(get_jenv_res == JNI_OK);
9031 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9032 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9033 LDKChannelUpdate msg_var = *msg;
9034 uint64_t msg_ref = 0;
9035 msg_var = ChannelUpdate_clone(msg);
9036 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9037 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9038 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9039 msg_ref = (uint64_t)msg_var.inner;
9040 if (msg_var.is_owned) {
9043 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9045 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
9046 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9047 (*env)->ExceptionDescribe(env);
9048 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
9050 if (get_jenv_res == JNI_EDETACHED) {
9051 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9054 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9055 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9057 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9058 if (get_jenv_res == JNI_EDETACHED) {
9059 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9061 DO_ASSERT(get_jenv_res == JNI_OK);
9063 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9064 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9065 LDKErrorMessage msg_var = *msg;
9066 uint64_t msg_ref = 0;
9067 msg_var = ErrorMessage_clone(msg);
9068 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9069 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9070 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9071 msg_ref = (uint64_t)msg_var.inner;
9072 if (msg_var.is_owned) {
9075 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9077 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
9078 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9079 (*env)->ExceptionDescribe(env);
9080 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
9082 if (get_jenv_res == JNI_EDETACHED) {
9083 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9086 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9087 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9088 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9089 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9091 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9092 jclass c = (*env)->GetObjectClass(env, o);
9094 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9095 atomic_init(&calls->refcnt, 1);
9096 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9097 calls->o = (*env)->NewWeakGlobalRef(env, o);
9098 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
9099 CHECK(calls->handle_open_channel_meth != NULL);
9100 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
9101 CHECK(calls->handle_accept_channel_meth != NULL);
9102 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
9103 CHECK(calls->handle_funding_created_meth != NULL);
9104 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
9105 CHECK(calls->handle_funding_signed_meth != NULL);
9106 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
9107 CHECK(calls->handle_funding_locked_meth != NULL);
9108 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
9109 CHECK(calls->handle_shutdown_meth != NULL);
9110 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
9111 CHECK(calls->handle_closing_signed_meth != NULL);
9112 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
9113 CHECK(calls->handle_update_add_htlc_meth != NULL);
9114 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
9115 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
9116 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
9117 CHECK(calls->handle_update_fail_htlc_meth != NULL);
9118 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
9119 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
9120 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
9121 CHECK(calls->handle_commitment_signed_meth != NULL);
9122 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
9123 CHECK(calls->handle_revoke_and_ack_meth != NULL);
9124 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
9125 CHECK(calls->handle_update_fee_meth != NULL);
9126 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
9127 CHECK(calls->handle_announcement_signatures_meth != NULL);
9128 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
9129 CHECK(calls->peer_disconnected_meth != NULL);
9130 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
9131 CHECK(calls->peer_connected_meth != NULL);
9132 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
9133 CHECK(calls->handle_channel_reestablish_meth != NULL);
9134 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
9135 CHECK(calls->handle_channel_update_meth != NULL);
9136 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
9137 CHECK(calls->handle_error_meth != NULL);
9139 LDKChannelMessageHandler ret = {
9140 .this_arg = (void*) calls,
9141 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9142 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9143 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9144 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9145 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
9146 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9147 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9148 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9149 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9150 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9151 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9152 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9153 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9154 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9155 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9156 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9157 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9158 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9159 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9160 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9161 .free = LDKChannelMessageHandler_JCalls_free,
9162 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9164 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9168 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9169 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9170 return (uint64_t)res_ptr;
9172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9173 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
9174 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9175 DO_ASSERT((res_ptr & 1) == 0);
9176 return (int64_t)(res_ptr | 1);
9178 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) {
9179 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9180 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9181 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9182 LDKPublicKey their_node_id_ref;
9183 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9184 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9185 LDKInitFeatures their_features_conv;
9186 their_features_conv.inner = (void*)(their_features & (~1));
9187 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9188 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9189 their_features_conv = InitFeatures_clone(&their_features_conv);
9190 LDKOpenChannel msg_conv;
9191 msg_conv.inner = (void*)(msg & (~1));
9192 msg_conv.is_owned = false;
9193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9194 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9197 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) {
9198 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9199 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9200 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9201 LDKPublicKey their_node_id_ref;
9202 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9203 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9204 LDKInitFeatures their_features_conv;
9205 their_features_conv.inner = (void*)(their_features & (~1));
9206 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9207 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9208 their_features_conv = InitFeatures_clone(&their_features_conv);
9209 LDKAcceptChannel msg_conv;
9210 msg_conv.inner = (void*)(msg & (~1));
9211 msg_conv.is_owned = false;
9212 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9213 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9216 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) {
9217 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9218 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9219 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9220 LDKPublicKey their_node_id_ref;
9221 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9222 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9223 LDKFundingCreated msg_conv;
9224 msg_conv.inner = (void*)(msg & (~1));
9225 msg_conv.is_owned = false;
9226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9227 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9230 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) {
9231 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9232 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9233 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9234 LDKPublicKey their_node_id_ref;
9235 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9236 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9237 LDKFundingSigned msg_conv;
9238 msg_conv.inner = (void*)(msg & (~1));
9239 msg_conv.is_owned = false;
9240 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9241 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9244 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) {
9245 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9246 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9247 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9248 LDKPublicKey their_node_id_ref;
9249 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9250 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9251 LDKFundingLocked msg_conv;
9252 msg_conv.inner = (void*)(msg & (~1));
9253 msg_conv.is_owned = false;
9254 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9255 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9258 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) {
9259 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9260 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9261 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9262 LDKPublicKey their_node_id_ref;
9263 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9264 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9265 LDKInitFeatures their_features_conv;
9266 their_features_conv.inner = (void*)(their_features & (~1));
9267 their_features_conv.is_owned = false;
9268 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9269 LDKShutdown msg_conv;
9270 msg_conv.inner = (void*)(msg & (~1));
9271 msg_conv.is_owned = false;
9272 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9273 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9276 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) {
9277 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9278 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9279 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9280 LDKPublicKey their_node_id_ref;
9281 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9282 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9283 LDKClosingSigned msg_conv;
9284 msg_conv.inner = (void*)(msg & (~1));
9285 msg_conv.is_owned = false;
9286 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9287 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9290 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) {
9291 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9292 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9293 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9294 LDKPublicKey their_node_id_ref;
9295 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9296 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9297 LDKUpdateAddHTLC msg_conv;
9298 msg_conv.inner = (void*)(msg & (~1));
9299 msg_conv.is_owned = false;
9300 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9301 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9304 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) {
9305 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9306 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9307 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9308 LDKPublicKey their_node_id_ref;
9309 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9310 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9311 LDKUpdateFulfillHTLC msg_conv;
9312 msg_conv.inner = (void*)(msg & (~1));
9313 msg_conv.is_owned = false;
9314 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9315 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9318 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) {
9319 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9320 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9321 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9322 LDKPublicKey their_node_id_ref;
9323 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9324 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9325 LDKUpdateFailHTLC msg_conv;
9326 msg_conv.inner = (void*)(msg & (~1));
9327 msg_conv.is_owned = false;
9328 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9329 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9332 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) {
9333 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9334 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9335 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9336 LDKPublicKey their_node_id_ref;
9337 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9338 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9339 LDKUpdateFailMalformedHTLC msg_conv;
9340 msg_conv.inner = (void*)(msg & (~1));
9341 msg_conv.is_owned = false;
9342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9343 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9346 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) {
9347 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9348 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9349 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9350 LDKPublicKey their_node_id_ref;
9351 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9352 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9353 LDKCommitmentSigned msg_conv;
9354 msg_conv.inner = (void*)(msg & (~1));
9355 msg_conv.is_owned = false;
9356 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9357 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9360 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) {
9361 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9362 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9363 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9364 LDKPublicKey their_node_id_ref;
9365 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9366 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9367 LDKRevokeAndACK msg_conv;
9368 msg_conv.inner = (void*)(msg & (~1));
9369 msg_conv.is_owned = false;
9370 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9371 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9374 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) {
9375 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9376 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9377 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9378 LDKPublicKey their_node_id_ref;
9379 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9380 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9381 LDKUpdateFee msg_conv;
9382 msg_conv.inner = (void*)(msg & (~1));
9383 msg_conv.is_owned = false;
9384 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9385 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9388 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) {
9389 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9390 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9391 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9392 LDKPublicKey their_node_id_ref;
9393 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9394 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9395 LDKAnnouncementSignatures msg_conv;
9396 msg_conv.inner = (void*)(msg & (~1));
9397 msg_conv.is_owned = false;
9398 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9399 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9402 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) {
9403 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9404 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9405 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9406 LDKPublicKey their_node_id_ref;
9407 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9408 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9409 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9412 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) {
9413 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9415 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9416 LDKPublicKey their_node_id_ref;
9417 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9418 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9420 msg_conv.inner = (void*)(msg & (~1));
9421 msg_conv.is_owned = false;
9422 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9423 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9426 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) {
9427 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9428 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9429 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9430 LDKPublicKey their_node_id_ref;
9431 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9432 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9433 LDKChannelReestablish msg_conv;
9434 msg_conv.inner = (void*)(msg & (~1));
9435 msg_conv.is_owned = false;
9436 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9437 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9440 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) {
9441 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9442 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9443 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9444 LDKPublicKey their_node_id_ref;
9445 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9446 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9447 LDKChannelUpdate msg_conv;
9448 msg_conv.inner = (void*)(msg & (~1));
9449 msg_conv.is_owned = false;
9450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9451 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9454 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) {
9455 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9457 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9458 LDKPublicKey their_node_id_ref;
9459 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9460 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9461 LDKErrorMessage msg_conv;
9462 msg_conv.inner = (void*)(msg & (~1));
9463 msg_conv.is_owned = false;
9464 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9465 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9468 typedef struct LDKRoutingMessageHandler_JCalls {
9469 atomic_size_t refcnt;
9472 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9473 jmethodID handle_node_announcement_meth;
9474 jmethodID handle_channel_announcement_meth;
9475 jmethodID handle_channel_update_meth;
9476 jmethodID get_next_channel_announcements_meth;
9477 jmethodID get_next_node_announcements_meth;
9478 jmethodID sync_routing_table_meth;
9479 jmethodID handle_reply_channel_range_meth;
9480 jmethodID handle_reply_short_channel_ids_end_meth;
9481 jmethodID handle_query_channel_range_meth;
9482 jmethodID handle_query_short_channel_ids_meth;
9483 } LDKRoutingMessageHandler_JCalls;
9484 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9485 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9486 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9488 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9489 if (get_jenv_res == JNI_EDETACHED) {
9490 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9492 DO_ASSERT(get_jenv_res == JNI_OK);
9494 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9495 if (get_jenv_res == JNI_EDETACHED) {
9496 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9501 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9502 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9504 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9505 if (get_jenv_res == JNI_EDETACHED) {
9506 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9508 DO_ASSERT(get_jenv_res == JNI_OK);
9510 LDKNodeAnnouncement msg_var = *msg;
9511 uint64_t msg_ref = 0;
9512 msg_var = NodeAnnouncement_clone(msg);
9513 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9514 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9515 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9516 msg_ref = (uint64_t)msg_var.inner;
9517 if (msg_var.is_owned) {
9520 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9522 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
9523 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9524 (*env)->ExceptionDescribe(env);
9525 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9527 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9528 CHECK_ACCESS(ret_ptr);
9529 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9531 if (get_jenv_res == JNI_EDETACHED) {
9532 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9536 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9537 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9539 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9540 if (get_jenv_res == JNI_EDETACHED) {
9541 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9543 DO_ASSERT(get_jenv_res == JNI_OK);
9545 LDKChannelAnnouncement msg_var = *msg;
9546 uint64_t msg_ref = 0;
9547 msg_var = ChannelAnnouncement_clone(msg);
9548 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9549 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9550 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9551 msg_ref = (uint64_t)msg_var.inner;
9552 if (msg_var.is_owned) {
9555 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9557 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
9558 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9559 (*env)->ExceptionDescribe(env);
9560 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9562 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9563 CHECK_ACCESS(ret_ptr);
9564 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9566 if (get_jenv_res == JNI_EDETACHED) {
9567 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9571 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9572 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9574 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9575 if (get_jenv_res == JNI_EDETACHED) {
9576 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9578 DO_ASSERT(get_jenv_res == JNI_OK);
9580 LDKChannelUpdate msg_var = *msg;
9581 uint64_t msg_ref = 0;
9582 msg_var = ChannelUpdate_clone(msg);
9583 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9584 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9585 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9586 msg_ref = (uint64_t)msg_var.inner;
9587 if (msg_var.is_owned) {
9590 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9592 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
9593 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9594 (*env)->ExceptionDescribe(env);
9595 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
9597 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9598 CHECK_ACCESS(ret_ptr);
9599 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9601 if (get_jenv_res == JNI_EDETACHED) {
9602 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9606 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9607 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9609 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9610 if (get_jenv_res == JNI_EDETACHED) {
9611 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9613 DO_ASSERT(get_jenv_res == JNI_OK);
9615 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9617 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
9618 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9619 (*env)->ExceptionDescribe(env);
9620 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9622 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9623 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9624 if (ret_constr.datalen > 0)
9625 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9627 ret_constr.data = NULL;
9628 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9629 for (size_t h = 0; h < ret_constr.datalen; h++) {
9630 int64_t ret_conv_59 = ret_vals[h];
9631 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
9632 CHECK_ACCESS(ret_conv_59_ptr);
9633 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9634 FREE((void*)ret_conv_59);
9635 ret_constr.data[h] = ret_conv_59_conv;
9637 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9638 if (get_jenv_res == JNI_EDETACHED) {
9639 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9643 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9644 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9646 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9647 if (get_jenv_res == JNI_EDETACHED) {
9648 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9650 DO_ASSERT(get_jenv_res == JNI_OK);
9652 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9653 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9654 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9656 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9657 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9658 (*env)->ExceptionDescribe(env);
9659 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9661 LDKCVec_NodeAnnouncementZ ret_constr;
9662 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9663 if (ret_constr.datalen > 0)
9664 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9666 ret_constr.data = NULL;
9667 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9668 for (size_t s = 0; s < ret_constr.datalen; s++) {
9669 int64_t ret_conv_18 = ret_vals[s];
9670 LDKNodeAnnouncement ret_conv_18_conv;
9671 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9672 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9674 ret_constr.data[s] = ret_conv_18_conv;
9676 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9677 if (get_jenv_res == JNI_EDETACHED) {
9678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9682 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9683 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9685 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9686 if (get_jenv_res == JNI_EDETACHED) {
9687 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9689 DO_ASSERT(get_jenv_res == JNI_OK);
9691 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9692 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9693 LDKInit init_var = *init;
9694 uint64_t init_ref = 0;
9695 init_var = Init_clone(init);
9696 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9697 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9698 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9699 init_ref = (uint64_t)init_var.inner;
9700 if (init_var.is_owned) {
9703 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9705 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9706 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9707 (*env)->ExceptionDescribe(env);
9708 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9710 if (get_jenv_res == JNI_EDETACHED) {
9711 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9714 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9715 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9717 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9718 if (get_jenv_res == JNI_EDETACHED) {
9719 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9721 DO_ASSERT(get_jenv_res == JNI_OK);
9723 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9724 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9725 LDKReplyChannelRange msg_var = msg;
9726 uint64_t msg_ref = 0;
9727 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9728 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9729 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9730 msg_ref = (uint64_t)msg_var.inner;
9731 if (msg_var.is_owned) {
9734 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9736 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9737 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9738 (*env)->ExceptionDescribe(env);
9739 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9741 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9742 CHECK_ACCESS(ret_ptr);
9743 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9745 if (get_jenv_res == JNI_EDETACHED) {
9746 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9750 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9751 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9753 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9754 if (get_jenv_res == JNI_EDETACHED) {
9755 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9757 DO_ASSERT(get_jenv_res == JNI_OK);
9759 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9760 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9761 LDKReplyShortChannelIdsEnd msg_var = msg;
9762 uint64_t msg_ref = 0;
9763 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9764 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9765 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9766 msg_ref = (uint64_t)msg_var.inner;
9767 if (msg_var.is_owned) {
9770 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9772 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9773 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9774 (*env)->ExceptionDescribe(env);
9775 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9777 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9778 CHECK_ACCESS(ret_ptr);
9779 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9781 if (get_jenv_res == JNI_EDETACHED) {
9782 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9786 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9787 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9789 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9790 if (get_jenv_res == JNI_EDETACHED) {
9791 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9793 DO_ASSERT(get_jenv_res == JNI_OK);
9795 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9796 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9797 LDKQueryChannelRange msg_var = msg;
9798 uint64_t msg_ref = 0;
9799 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9800 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9801 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9802 msg_ref = (uint64_t)msg_var.inner;
9803 if (msg_var.is_owned) {
9806 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9808 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9809 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9810 (*env)->ExceptionDescribe(env);
9811 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9813 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9814 CHECK_ACCESS(ret_ptr);
9815 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9817 if (get_jenv_res == JNI_EDETACHED) {
9818 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9822 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9823 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9825 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9826 if (get_jenv_res == JNI_EDETACHED) {
9827 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9829 DO_ASSERT(get_jenv_res == JNI_OK);
9831 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9832 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9833 LDKQueryShortChannelIds msg_var = msg;
9834 uint64_t msg_ref = 0;
9835 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9836 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9837 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9838 msg_ref = (uint64_t)msg_var.inner;
9839 if (msg_var.is_owned) {
9842 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9844 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9845 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9846 (*env)->ExceptionDescribe(env);
9847 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9849 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9850 CHECK_ACCESS(ret_ptr);
9851 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9853 if (get_jenv_res == JNI_EDETACHED) {
9854 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9858 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9859 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9860 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9861 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9863 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9864 jclass c = (*env)->GetObjectClass(env, o);
9866 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9867 atomic_init(&calls->refcnt, 1);
9868 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9869 calls->o = (*env)->NewWeakGlobalRef(env, o);
9870 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9871 CHECK(calls->handle_node_announcement_meth != NULL);
9872 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9873 CHECK(calls->handle_channel_announcement_meth != NULL);
9874 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9875 CHECK(calls->handle_channel_update_meth != NULL);
9876 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9877 CHECK(calls->get_next_channel_announcements_meth != NULL);
9878 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9879 CHECK(calls->get_next_node_announcements_meth != NULL);
9880 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9881 CHECK(calls->sync_routing_table_meth != NULL);
9882 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9883 CHECK(calls->handle_reply_channel_range_meth != NULL);
9884 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9885 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9886 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9887 CHECK(calls->handle_query_channel_range_meth != NULL);
9888 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9889 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9891 LDKRoutingMessageHandler ret = {
9892 .this_arg = (void*) calls,
9893 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9894 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9895 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9896 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9897 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9898 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9899 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9900 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9901 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9902 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9903 .free = LDKRoutingMessageHandler_JCalls_free,
9904 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9906 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9910 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9911 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9912 return (uint64_t)res_ptr;
9914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9915 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9916 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9917 DO_ASSERT((res_ptr & 1) == 0);
9918 return (int64_t)(res_ptr | 1);
9920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9921 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9922 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9923 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9924 LDKNodeAnnouncement msg_conv;
9925 msg_conv.inner = (void*)(msg & (~1));
9926 msg_conv.is_owned = false;
9927 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9928 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9929 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9930 return (uint64_t)ret_conv;
9933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9934 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9935 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9936 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9937 LDKChannelAnnouncement msg_conv;
9938 msg_conv.inner = (void*)(msg & (~1));
9939 msg_conv.is_owned = false;
9940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9941 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9942 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9943 return (uint64_t)ret_conv;
9946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9947 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9949 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9950 LDKChannelUpdate msg_conv;
9951 msg_conv.inner = (void*)(msg & (~1));
9952 msg_conv.is_owned = false;
9953 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9954 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9955 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9956 return (uint64_t)ret_conv;
9959 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) {
9960 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9961 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9962 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9963 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9964 int64_tArray ret_arr = NULL;
9965 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9966 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9967 for (size_t h = 0; h < ret_var.datalen; h++) {
9968 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9969 *ret_conv_59_conv = ret_var.data[h];
9970 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
9972 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9977 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) {
9978 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9980 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9981 LDKPublicKey starting_point_ref;
9982 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9983 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9984 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9985 int64_tArray ret_arr = NULL;
9986 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9987 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9988 for (size_t s = 0; s < ret_var.datalen; s++) {
9989 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9990 uint64_t ret_conv_18_ref = 0;
9991 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9992 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
9994 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9995 if (ret_conv_18_var.is_owned) {
9996 ret_conv_18_ref |= 1;
9998 ret_arr_ptr[s] = ret_conv_18_ref;
10000 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10001 FREE(ret_var.data);
10005 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) {
10006 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10007 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10008 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10009 LDKPublicKey their_node_id_ref;
10010 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10011 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10013 init_conv.inner = (void*)(init & (~1));
10014 init_conv.is_owned = false;
10015 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10016 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10019 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) {
10020 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10021 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10022 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10023 LDKPublicKey their_node_id_ref;
10024 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10025 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10026 LDKReplyChannelRange msg_conv;
10027 msg_conv.inner = (void*)(msg & (~1));
10028 msg_conv.is_owned = (msg & 1) || (msg == 0);
10029 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10030 msg_conv = ReplyChannelRange_clone(&msg_conv);
10031 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10032 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10033 return (uint64_t)ret_conv;
10036 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) {
10037 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10038 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10039 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10040 LDKPublicKey their_node_id_ref;
10041 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10042 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10043 LDKReplyShortChannelIdsEnd msg_conv;
10044 msg_conv.inner = (void*)(msg & (~1));
10045 msg_conv.is_owned = (msg & 1) || (msg == 0);
10046 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10047 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10048 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10049 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10050 return (uint64_t)ret_conv;
10053 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) {
10054 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10055 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10056 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10057 LDKPublicKey their_node_id_ref;
10058 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10059 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10060 LDKQueryChannelRange msg_conv;
10061 msg_conv.inner = (void*)(msg & (~1));
10062 msg_conv.is_owned = (msg & 1) || (msg == 0);
10063 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10064 msg_conv = QueryChannelRange_clone(&msg_conv);
10065 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10066 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10067 return (uint64_t)ret_conv;
10070 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) {
10071 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10072 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10073 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10074 LDKPublicKey their_node_id_ref;
10075 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10076 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10077 LDKQueryShortChannelIds msg_conv;
10078 msg_conv.inner = (void*)(msg & (~1));
10079 msg_conv.is_owned = (msg & 1) || (msg == 0);
10080 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10081 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10082 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10083 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10084 return (uint64_t)ret_conv;
10087 typedef struct LDKCustomMessageReader_JCalls {
10088 atomic_size_t refcnt;
10091 jmethodID read_meth;
10092 } LDKCustomMessageReader_JCalls;
10093 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10094 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10095 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10098 if (get_jenv_res == JNI_EDETACHED) {
10099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10101 DO_ASSERT(get_jenv_res == JNI_OK);
10103 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10104 if (get_jenv_res == JNI_EDETACHED) {
10105 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10110 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10111 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10113 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10114 if (get_jenv_res == JNI_EDETACHED) {
10115 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10117 DO_ASSERT(get_jenv_res == JNI_OK);
10119 LDKu8slice buffer_var = buffer;
10120 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
10121 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
10122 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10123 CHECK(obj != NULL);
10124 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
10125 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10126 (*env)->ExceptionDescribe(env);
10127 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
10129 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10130 CHECK_ACCESS(ret_ptr);
10131 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10133 if (get_jenv_res == JNI_EDETACHED) {
10134 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10138 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10139 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10140 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10142 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
10143 jclass c = (*env)->GetObjectClass(env, o);
10145 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10146 atomic_init(&calls->refcnt, 1);
10147 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10148 calls->o = (*env)->NewWeakGlobalRef(env, o);
10149 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
10150 CHECK(calls->read_meth != NULL);
10152 LDKCustomMessageReader ret = {
10153 .this_arg = (void*) calls,
10154 .read = read_LDKCustomMessageReader_jcall,
10155 .free = LDKCustomMessageReader_JCalls_free,
10159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
10160 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10161 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
10162 return (uint64_t)res_ptr;
10164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
10165 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10167 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10168 LDKu8slice buffer_ref;
10169 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
10170 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
10171 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10172 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10173 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
10174 return (uint64_t)ret_conv;
10177 typedef struct LDKCustomMessageHandler_JCalls {
10178 atomic_size_t refcnt;
10181 LDKCustomMessageReader_JCalls* CustomMessageReader;
10182 jmethodID handle_custom_message_meth;
10183 jmethodID get_and_clear_pending_msg_meth;
10184 } LDKCustomMessageHandler_JCalls;
10185 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10186 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10187 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10189 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10190 if (get_jenv_res == JNI_EDETACHED) {
10191 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10193 DO_ASSERT(get_jenv_res == JNI_OK);
10195 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10196 if (get_jenv_res == JNI_EDETACHED) {
10197 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10202 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10203 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10205 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10206 if (get_jenv_res == JNI_EDETACHED) {
10207 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10209 DO_ASSERT(get_jenv_res == JNI_OK);
10211 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10213 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
10214 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
10215 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10216 CHECK(obj != NULL);
10217 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
10218 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10219 (*env)->ExceptionDescribe(env);
10220 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
10222 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10223 CHECK_ACCESS(ret_ptr);
10224 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10226 if (get_jenv_res == JNI_EDETACHED) {
10227 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10231 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10232 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10234 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10235 if (get_jenv_res == JNI_EDETACHED) {
10236 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10238 DO_ASSERT(get_jenv_res == JNI_OK);
10240 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10241 CHECK(obj != NULL);
10242 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
10243 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10244 (*env)->ExceptionDescribe(env);
10245 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
10247 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10248 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10249 if (ret_constr.datalen > 0)
10250 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10252 ret_constr.data = NULL;
10253 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10254 for (size_t z = 0; z < ret_constr.datalen; z++) {
10255 int64_t ret_conv_25 = ret_vals[z];
10256 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
10257 CHECK_ACCESS(ret_conv_25_ptr);
10258 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10259 FREE((void*)ret_conv_25);
10260 ret_constr.data[z] = ret_conv_25_conv;
10262 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10263 if (get_jenv_res == JNI_EDETACHED) {
10264 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10268 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10269 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10270 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10271 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10273 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
10274 jclass c = (*env)->GetObjectClass(env, o);
10276 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10277 atomic_init(&calls->refcnt, 1);
10278 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10279 calls->o = (*env)->NewWeakGlobalRef(env, o);
10280 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
10281 CHECK(calls->handle_custom_message_meth != NULL);
10282 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
10283 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
10285 LDKCustomMessageHandler ret = {
10286 .this_arg = (void*) calls,
10287 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10288 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10289 .free = LDKCustomMessageHandler_JCalls_free,
10290 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
10292 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
10296 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10297 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
10298 return (uint64_t)res_ptr;
10300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
10301 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
10302 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
10303 DO_ASSERT((res_ptr & 1) == 0);
10304 return (int64_t)(res_ptr | 1);
10306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
10307 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10308 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10309 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10310 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
10311 CHECK_ACCESS(msg_ptr);
10312 LDKType msg_conv = *(LDKType*)(msg_ptr);
10313 if (msg_conv.free == LDKType_JCalls_free) {
10314 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10315 LDKType_JCalls_cloned(&msg_conv);
10317 LDKPublicKey sender_node_id_ref;
10318 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
10319 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
10320 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10321 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10322 return (uint64_t)ret_conv;
10325 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
10326 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10327 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10328 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10329 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10330 int64_tArray ret_arr = NULL;
10331 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10332 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10333 for (size_t z = 0; z < ret_var.datalen; z++) {
10334 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10335 *ret_conv_25_conv = ret_var.data[z];
10336 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
10338 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10339 FREE(ret_var.data);
10343 typedef struct LDKSocketDescriptor_JCalls {
10344 atomic_size_t refcnt;
10347 jmethodID send_data_meth;
10348 jmethodID disconnect_socket_meth;
10350 jmethodID hash_meth;
10351 } LDKSocketDescriptor_JCalls;
10352 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10353 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10354 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10356 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10357 if (get_jenv_res == JNI_EDETACHED) {
10358 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10360 DO_ASSERT(get_jenv_res == JNI_OK);
10362 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10363 if (get_jenv_res == JNI_EDETACHED) {
10364 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10369 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10370 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10372 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10373 if (get_jenv_res == JNI_EDETACHED) {
10374 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10376 DO_ASSERT(get_jenv_res == JNI_OK);
10378 LDKu8slice data_var = data;
10379 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
10380 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
10381 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10382 CHECK(obj != NULL);
10383 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
10384 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10385 (*env)->ExceptionDescribe(env);
10386 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
10388 if (get_jenv_res == JNI_EDETACHED) {
10389 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10393 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10394 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10396 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10397 if (get_jenv_res == JNI_EDETACHED) {
10398 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10400 DO_ASSERT(get_jenv_res == JNI_OK);
10402 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10403 CHECK(obj != NULL);
10404 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
10405 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10406 (*env)->ExceptionDescribe(env);
10407 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
10409 if (get_jenv_res == JNI_EDETACHED) {
10410 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10413 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10414 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10416 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10417 if (get_jenv_res == JNI_EDETACHED) {
10418 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10420 DO_ASSERT(get_jenv_res == JNI_OK);
10422 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10423 *other_arg_clone = SocketDescriptor_clone(other_arg);
10424 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10425 CHECK(obj != NULL);
10426 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
10427 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10428 (*env)->ExceptionDescribe(env);
10429 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
10431 if (get_jenv_res == JNI_EDETACHED) {
10432 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10436 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10437 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10439 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10440 if (get_jenv_res == JNI_EDETACHED) {
10441 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10443 DO_ASSERT(get_jenv_res == JNI_OK);
10445 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10446 CHECK(obj != NULL);
10447 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
10448 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10449 (*env)->ExceptionDescribe(env);
10450 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
10452 if (get_jenv_res == JNI_EDETACHED) {
10453 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10457 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10458 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10461 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
10462 jclass c = (*env)->GetObjectClass(env, o);
10464 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10465 atomic_init(&calls->refcnt, 1);
10466 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10467 calls->o = (*env)->NewWeakGlobalRef(env, o);
10468 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
10469 CHECK(calls->send_data_meth != NULL);
10470 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
10471 CHECK(calls->disconnect_socket_meth != NULL);
10472 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
10473 CHECK(calls->eq_meth != NULL);
10474 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
10475 CHECK(calls->hash_meth != NULL);
10477 LDKSocketDescriptor ret = {
10478 .this_arg = (void*) calls,
10479 .send_data = send_data_LDKSocketDescriptor_jcall,
10480 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10481 .eq = eq_LDKSocketDescriptor_jcall,
10482 .hash = hash_LDKSocketDescriptor_jcall,
10483 .cloned = LDKSocketDescriptor_JCalls_cloned,
10484 .free = LDKSocketDescriptor_JCalls_free,
10488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
10489 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10490 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
10491 return (uint64_t)res_ptr;
10493 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) {
10494 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10495 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10496 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10497 LDKu8slice data_ref;
10498 data_ref.datalen = (*env)->GetArrayLength(env, data);
10499 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
10500 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10501 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
10505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
10506 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10508 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10509 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
10513 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10514 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10515 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10516 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
10520 typedef struct LDKScore_JCalls {
10521 atomic_size_t refcnt;
10524 jmethodID channel_penalty_msat_meth;
10525 jmethodID payment_path_failed_meth;
10526 jmethodID payment_path_successful_meth;
10527 jmethodID write_meth;
10529 static void LDKScore_JCalls_free(void* this_arg) {
10530 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10531 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10533 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10534 if (get_jenv_res == JNI_EDETACHED) {
10535 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10537 DO_ASSERT(get_jenv_res == JNI_OK);
10539 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10540 if (get_jenv_res == JNI_EDETACHED) {
10541 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10546 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
10547 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10549 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10550 if (get_jenv_res == JNI_EDETACHED) {
10551 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10553 DO_ASSERT(get_jenv_res == JNI_OK);
10555 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10556 *channel_capacity_msat_copy = channel_capacity_msat;
10557 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
10558 LDKNodeId source_var = *source;
10559 uint64_t source_ref = 0;
10560 source_var = NodeId_clone(source);
10561 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10562 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10563 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10564 source_ref = (uint64_t)source_var.inner;
10565 if (source_var.is_owned) {
10568 LDKNodeId target_var = *target;
10569 uint64_t target_ref = 0;
10570 target_var = NodeId_clone(target);
10571 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10572 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10573 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10574 target_ref = (uint64_t)target_var.inner;
10575 if (target_var.is_owned) {
10578 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10579 CHECK(obj != NULL);
10580 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref);
10581 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10582 (*env)->ExceptionDescribe(env);
10583 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10585 if (get_jenv_res == JNI_EDETACHED) {
10586 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10590 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10591 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10593 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10594 if (get_jenv_res == JNI_EDETACHED) {
10595 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10597 DO_ASSERT(get_jenv_res == JNI_OK);
10599 LDKCVec_RouteHopZ path_var = path;
10600 int64_tArray path_arr = NULL;
10601 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10602 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10603 for (size_t k = 0; k < path_var.datalen; k++) {
10604 LDKRouteHop path_conv_10_var = path_var.data[k];
10605 uint64_t path_conv_10_ref = 0;
10606 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10607 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10608 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10609 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
10610 if (path_conv_10_var.is_owned) {
10611 path_conv_10_ref |= 1;
10613 path_arr_ptr[k] = path_conv_10_ref;
10615 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10616 FREE(path_var.data);
10617 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10618 CHECK(obj != NULL);
10619 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
10620 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10621 (*env)->ExceptionDescribe(env);
10622 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10624 if (get_jenv_res == JNI_EDETACHED) {
10625 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10628 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10629 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10631 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10632 if (get_jenv_res == JNI_EDETACHED) {
10633 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10635 DO_ASSERT(get_jenv_res == JNI_OK);
10637 LDKCVec_RouteHopZ path_var = path;
10638 int64_tArray path_arr = NULL;
10639 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10640 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10641 for (size_t k = 0; k < path_var.datalen; k++) {
10642 LDKRouteHop path_conv_10_var = path_var.data[k];
10643 uint64_t path_conv_10_ref = 0;
10644 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10645 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10646 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10647 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
10648 if (path_conv_10_var.is_owned) {
10649 path_conv_10_ref |= 1;
10651 path_arr_ptr[k] = path_conv_10_ref;
10653 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10654 FREE(path_var.data);
10655 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10656 CHECK(obj != NULL);
10657 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
10658 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10659 (*env)->ExceptionDescribe(env);
10660 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
10662 if (get_jenv_res == JNI_EDETACHED) {
10663 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10666 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10667 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10669 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10670 if (get_jenv_res == JNI_EDETACHED) {
10671 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10673 DO_ASSERT(get_jenv_res == JNI_OK);
10675 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10676 CHECK(obj != NULL);
10677 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10678 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10679 (*env)->ExceptionDescribe(env);
10680 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10682 LDKCVec_u8Z ret_ref;
10683 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10684 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10685 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10686 if (get_jenv_res == JNI_EDETACHED) {
10687 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10691 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10692 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10693 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10695 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10696 jclass c = (*env)->GetObjectClass(env, o);
10698 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10699 atomic_init(&calls->refcnt, 1);
10700 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10701 calls->o = (*env)->NewWeakGlobalRef(env, o);
10702 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
10703 CHECK(calls->channel_penalty_msat_meth != NULL);
10704 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10705 CHECK(calls->payment_path_failed_meth != NULL);
10706 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
10707 CHECK(calls->payment_path_successful_meth != NULL);
10708 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10709 CHECK(calls->write_meth != NULL);
10712 .this_arg = (void*) calls,
10713 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10714 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10715 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10716 .write = write_LDKScore_jcall,
10717 .free = LDKScore_JCalls_free,
10721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10722 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10723 *res_ptr = LDKScore_init(env, clz, o);
10724 return (uint64_t)res_ptr;
10726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) {
10727 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10728 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10729 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10730 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
10731 CHECK_ACCESS(channel_capacity_msat_ptr);
10732 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
10733 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
10734 LDKNodeId source_conv;
10735 source_conv.inner = (void*)(source & (~1));
10736 source_conv.is_owned = false;
10737 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10738 LDKNodeId target_conv;
10739 target_conv.inner = (void*)(target & (~1));
10740 target_conv.is_owned = false;
10741 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10742 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv);
10746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10747 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10748 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10749 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10750 LDKCVec_RouteHopZ path_constr;
10751 path_constr.datalen = (*env)->GetArrayLength(env, path);
10752 if (path_constr.datalen > 0)
10753 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10755 path_constr.data = NULL;
10756 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10757 for (size_t k = 0; k < path_constr.datalen; k++) {
10758 int64_t path_conv_10 = path_vals[k];
10759 LDKRouteHop path_conv_10_conv;
10760 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10761 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10762 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10763 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10764 path_constr.data[k] = path_conv_10_conv;
10766 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10767 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10771 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10772 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10773 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10774 LDKCVec_RouteHopZ path_constr;
10775 path_constr.datalen = (*env)->GetArrayLength(env, path);
10776 if (path_constr.datalen > 0)
10777 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10779 path_constr.data = NULL;
10780 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10781 for (size_t k = 0; k < path_constr.datalen; k++) {
10782 int64_t path_conv_10 = path_vals[k];
10783 LDKRouteHop path_conv_10_conv;
10784 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10785 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10786 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10787 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10788 path_constr.data[k] = path_conv_10_conv;
10790 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10791 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10795 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10796 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10797 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10798 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10799 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10800 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10801 CVec_u8Z_free(ret_var);
10805 typedef struct LDKLockableScore_JCalls {
10806 atomic_size_t refcnt;
10809 jmethodID lock_meth;
10810 } LDKLockableScore_JCalls;
10811 static void LDKLockableScore_JCalls_free(void* this_arg) {
10812 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10813 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10815 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10816 if (get_jenv_res == JNI_EDETACHED) {
10817 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10819 DO_ASSERT(get_jenv_res == JNI_OK);
10821 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10822 if (get_jenv_res == JNI_EDETACHED) {
10823 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10828 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10829 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10831 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10832 if (get_jenv_res == JNI_EDETACHED) {
10833 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10835 DO_ASSERT(get_jenv_res == JNI_OK);
10837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10838 CHECK(obj != NULL);
10839 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
10840 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10841 (*env)->ExceptionDescribe(env);
10842 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
10844 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10845 CHECK_ACCESS(ret_ptr);
10846 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10847 if (ret_conv.free == LDKScore_JCalls_free) {
10848 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10849 LDKScore_JCalls_cloned(&ret_conv);
10850 }// Warning: we may need a move here but no clone is available for LDKScore
10852 if (get_jenv_res == JNI_EDETACHED) {
10853 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10857 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10858 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10859 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10861 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
10862 jclass c = (*env)->GetObjectClass(env, o);
10864 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10865 atomic_init(&calls->refcnt, 1);
10866 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10867 calls->o = (*env)->NewWeakGlobalRef(env, o);
10868 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
10869 CHECK(calls->lock_meth != NULL);
10871 LDKLockableScore ret = {
10872 .this_arg = (void*) calls,
10873 .lock = lock_LDKLockableScore_jcall,
10874 .free = LDKLockableScore_JCalls_free,
10878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
10879 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10880 *res_ptr = LDKLockableScore_init(env, clz, o);
10881 return (uint64_t)res_ptr;
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
10884 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10885 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10886 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10887 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10888 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10889 return (uint64_t)ret_ret;
10892 typedef struct LDKChannelManagerPersister_JCalls {
10893 atomic_size_t refcnt;
10896 jmethodID persist_manager_meth;
10897 } LDKChannelManagerPersister_JCalls;
10898 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
10899 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10900 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10903 if (get_jenv_res == JNI_EDETACHED) {
10904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10906 DO_ASSERT(get_jenv_res == JNI_OK);
10908 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10909 if (get_jenv_res == JNI_EDETACHED) {
10910 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10915 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10916 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10918 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10919 if (get_jenv_res == JNI_EDETACHED) {
10920 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10922 DO_ASSERT(get_jenv_res == JNI_OK);
10924 LDKChannelManager channel_manager_var = *channel_manager;
10925 uint64_t channel_manager_ref = 0;
10926 // Warning: we may need a move here but no clone is available for LDKChannelManager
10927 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10928 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10929 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10930 channel_manager_ref = (uint64_t)channel_manager_var.inner;
10931 if (channel_manager_var.is_owned) {
10932 channel_manager_ref |= 1;
10934 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10935 CHECK(obj != NULL);
10936 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10937 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10938 (*env)->ExceptionDescribe(env);
10939 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
10941 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10942 CHECK_ACCESS(ret_ptr);
10943 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10945 if (get_jenv_res == JNI_EDETACHED) {
10946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10950 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
10951 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
10952 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10954 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
10955 jclass c = (*env)->GetObjectClass(env, o);
10957 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
10958 atomic_init(&calls->refcnt, 1);
10959 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10960 calls->o = (*env)->NewWeakGlobalRef(env, o);
10961 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10962 CHECK(calls->persist_manager_meth != NULL);
10964 LDKChannelManagerPersister ret = {
10965 .this_arg = (void*) calls,
10966 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
10967 .free = LDKChannelManagerPersister_JCalls_free,
10971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10972 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
10973 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
10974 return (uint64_t)res_ptr;
10976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10977 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10978 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10979 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
10980 LDKChannelManager channel_manager_conv;
10981 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10982 channel_manager_conv.is_owned = false;
10983 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10984 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10985 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10986 return (uint64_t)ret_conv;
10989 static jclass LDKFallback_SegWitProgram_class = NULL;
10990 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
10991 static jclass LDKFallback_PubKeyHash_class = NULL;
10992 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
10993 static jclass LDKFallback_ScriptHash_class = NULL;
10994 static jmethodID LDKFallback_ScriptHash_meth = NULL;
10995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
10996 LDKFallback_SegWitProgram_class =
10997 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
10998 CHECK(LDKFallback_SegWitProgram_class != NULL);
10999 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
11000 CHECK(LDKFallback_SegWitProgram_meth != NULL);
11001 LDKFallback_PubKeyHash_class =
11002 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
11003 CHECK(LDKFallback_PubKeyHash_class != NULL);
11004 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
11005 CHECK(LDKFallback_PubKeyHash_meth != NULL);
11006 LDKFallback_ScriptHash_class =
11007 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
11008 CHECK(LDKFallback_ScriptHash_class != NULL);
11009 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
11010 CHECK(LDKFallback_ScriptHash_meth != NULL);
11012 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11013 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
11015 case LDKFallback_SegWitProgram: {
11016 uint8_t version_val = obj->seg_wit_program.version._0;
11017 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11018 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
11019 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
11020 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
11022 case LDKFallback_PubKeyHash: {
11023 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
11024 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
11025 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
11027 case LDKFallback_ScriptHash: {
11028 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
11029 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
11030 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
11035 typedef struct LDKPayer_JCalls {
11036 atomic_size_t refcnt;
11039 jmethodID node_id_meth;
11040 jmethodID first_hops_meth;
11041 jmethodID send_payment_meth;
11042 jmethodID send_spontaneous_payment_meth;
11043 jmethodID retry_payment_meth;
11044 jmethodID abandon_payment_meth;
11046 static void LDKPayer_JCalls_free(void* this_arg) {
11047 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11048 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11050 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11051 if (get_jenv_res == JNI_EDETACHED) {
11052 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11054 DO_ASSERT(get_jenv_res == JNI_OK);
11056 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11057 if (get_jenv_res == JNI_EDETACHED) {
11058 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11063 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
11064 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11066 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11067 if (get_jenv_res == JNI_EDETACHED) {
11068 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11070 DO_ASSERT(get_jenv_res == JNI_OK);
11072 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11073 CHECK(obj != NULL);
11074 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
11075 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11076 (*env)->ExceptionDescribe(env);
11077 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
11079 LDKPublicKey ret_ref;
11080 CHECK((*env)->GetArrayLength(env, ret) == 33);
11081 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
11082 if (get_jenv_res == JNI_EDETACHED) {
11083 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11087 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
11088 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11090 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11091 if (get_jenv_res == JNI_EDETACHED) {
11092 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11094 DO_ASSERT(get_jenv_res == JNI_OK);
11096 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11097 CHECK(obj != NULL);
11098 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
11099 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11100 (*env)->ExceptionDescribe(env);
11101 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
11103 LDKCVec_ChannelDetailsZ ret_constr;
11104 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11105 if (ret_constr.datalen > 0)
11106 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11108 ret_constr.data = NULL;
11109 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11110 for (size_t q = 0; q < ret_constr.datalen; q++) {
11111 int64_t ret_conv_16 = ret_vals[q];
11112 LDKChannelDetails ret_conv_16_conv;
11113 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
11114 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
11115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
11116 ret_constr.data[q] = ret_conv_16_conv;
11118 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11119 if (get_jenv_res == JNI_EDETACHED) {
11120 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11124 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
11125 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11127 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11128 if (get_jenv_res == JNI_EDETACHED) {
11129 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11131 DO_ASSERT(get_jenv_res == JNI_OK);
11133 LDKRoute route_var = *route;
11134 uint64_t route_ref = 0;
11135 route_var = Route_clone(route);
11136 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11137 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11138 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11139 route_ref = (uint64_t)route_var.inner;
11140 if (route_var.is_owned) {
11143 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11144 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
11145 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
11146 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
11147 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11148 CHECK(obj != NULL);
11149 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
11150 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11151 (*env)->ExceptionDescribe(env);
11152 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
11154 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11155 CHECK_ACCESS(ret_ptr);
11156 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
11158 if (get_jenv_res == JNI_EDETACHED) {
11159 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11163 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
11164 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11166 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11167 if (get_jenv_res == JNI_EDETACHED) {
11168 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11170 DO_ASSERT(get_jenv_res == JNI_OK);
11172 LDKRoute route_var = *route;
11173 uint64_t route_ref = 0;
11174 route_var = Route_clone(route);
11175 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11176 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11177 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11178 route_ref = (uint64_t)route_var.inner;
11179 if (route_var.is_owned) {
11182 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
11183 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
11184 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11185 CHECK(obj != NULL);
11186 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
11187 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11188 (*env)->ExceptionDescribe(env);
11189 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
11191 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11192 CHECK_ACCESS(ret_ptr);
11193 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
11195 if (get_jenv_res == JNI_EDETACHED) {
11196 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11200 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
11201 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11203 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11204 if (get_jenv_res == JNI_EDETACHED) {
11205 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11207 DO_ASSERT(get_jenv_res == JNI_OK);
11209 LDKRoute route_var = *route;
11210 uint64_t route_ref = 0;
11211 route_var = Route_clone(route);
11212 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11213 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11214 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11215 route_ref = (uint64_t)route_var.inner;
11216 if (route_var.is_owned) {
11219 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
11220 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
11221 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11222 CHECK(obj != NULL);
11223 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
11224 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11225 (*env)->ExceptionDescribe(env);
11226 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
11228 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11229 CHECK_ACCESS(ret_ptr);
11230 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11232 if (get_jenv_res == JNI_EDETACHED) {
11233 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11237 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
11238 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11240 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11241 if (get_jenv_res == JNI_EDETACHED) {
11242 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11244 DO_ASSERT(get_jenv_res == JNI_OK);
11246 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
11247 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
11248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11249 CHECK(obj != NULL);
11250 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
11251 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11252 (*env)->ExceptionDescribe(env);
11253 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
11255 if (get_jenv_res == JNI_EDETACHED) {
11256 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11259 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
11260 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
11261 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11263 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
11264 jclass c = (*env)->GetObjectClass(env, o);
11266 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
11267 atomic_init(&calls->refcnt, 1);
11268 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11269 calls->o = (*env)->NewWeakGlobalRef(env, o);
11270 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
11271 CHECK(calls->node_id_meth != NULL);
11272 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
11273 CHECK(calls->first_hops_meth != NULL);
11274 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
11275 CHECK(calls->send_payment_meth != NULL);
11276 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
11277 CHECK(calls->send_spontaneous_payment_meth != NULL);
11278 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
11279 CHECK(calls->retry_payment_meth != NULL);
11280 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
11281 CHECK(calls->abandon_payment_meth != NULL);
11284 .this_arg = (void*) calls,
11285 .node_id = node_id_LDKPayer_jcall,
11286 .first_hops = first_hops_LDKPayer_jcall,
11287 .send_payment = send_payment_LDKPayer_jcall,
11288 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
11289 .retry_payment = retry_payment_LDKPayer_jcall,
11290 .abandon_payment = abandon_payment_LDKPayer_jcall,
11291 .free = LDKPayer_JCalls_free,
11295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
11296 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
11297 *res_ptr = LDKPayer_init(env, clz, o);
11298 return (uint64_t)res_ptr;
11300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11301 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11302 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11303 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11304 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11305 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
11309 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
11310 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11312 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11313 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
11314 int64_tArray ret_arr = NULL;
11315 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11316 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11317 for (size_t q = 0; q < ret_var.datalen; q++) {
11318 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11319 uint64_t ret_conv_16_ref = 0;
11320 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11321 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
11323 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
11324 if (ret_conv_16_var.is_owned) {
11325 ret_conv_16_ref |= 1;
11327 ret_arr_ptr[q] = ret_conv_16_ref;
11329 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11330 FREE(ret_var.data);
11334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11335 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11336 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11337 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11338 LDKRoute route_conv;
11339 route_conv.inner = (void*)(route & (~1));
11340 route_conv.is_owned = false;
11341 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11342 LDKThirtyTwoBytes payment_hash_ref;
11343 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11344 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
11345 LDKThirtyTwoBytes payment_secret_ref;
11346 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11347 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11348 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11349 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
11350 return (uint64_t)ret_conv;
11353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
11354 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11355 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11356 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11357 LDKRoute route_conv;
11358 route_conv.inner = (void*)(route & (~1));
11359 route_conv.is_owned = false;
11360 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11361 LDKThirtyTwoBytes payment_preimage_ref;
11362 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
11363 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
11364 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11365 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
11366 return (uint64_t)ret_conv;
11369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
11370 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11371 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11372 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11373 LDKRoute route_conv;
11374 route_conv.inner = (void*)(route & (~1));
11375 route_conv.is_owned = false;
11376 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11377 LDKThirtyTwoBytes payment_id_ref;
11378 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
11379 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
11380 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11381 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
11382 return (uint64_t)ret_conv;
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
11386 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11387 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11388 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11389 LDKThirtyTwoBytes payment_id_ref;
11390 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
11391 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
11392 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
11395 typedef struct LDKRouter_JCalls {
11396 atomic_size_t refcnt;
11399 jmethodID find_route_meth;
11400 } LDKRouter_JCalls;
11401 static void LDKRouter_JCalls_free(void* this_arg) {
11402 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11403 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11405 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11406 if (get_jenv_res == JNI_EDETACHED) {
11407 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11409 DO_ASSERT(get_jenv_res == JNI_OK);
11411 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11412 if (get_jenv_res == JNI_EDETACHED) {
11413 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11418 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
11419 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11421 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11422 if (get_jenv_res == JNI_EDETACHED) {
11423 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11425 DO_ASSERT(get_jenv_res == JNI_OK);
11427 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
11428 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
11429 LDKRouteParameters params_var = *params;
11430 uint64_t params_ref = 0;
11431 params_var = RouteParameters_clone(params);
11432 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11433 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11434 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var);
11435 params_ref = (uint64_t)params_var.inner;
11436 if (params_var.is_owned) {
11439 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11440 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
11441 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
11442 int64_tArray first_hops_arr = NULL;
11443 if (first_hops != NULL) {
11444 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
11445 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
11446 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
11447 for (size_t q = 0; q < first_hops_var.datalen; q++) {
11448 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
11449 uint64_t first_hops_conv_16_ref = 0;
11450 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11451 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11452 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
11453 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
11454 if (first_hops_conv_16_var.is_owned) {
11455 first_hops_conv_16_ref |= 1;
11457 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
11459 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
11461 // WARNING: This object doesn't live past this scope, needs clone!
11462 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
11463 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11464 CHECK(obj != NULL);
11465 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
11466 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11467 (*env)->ExceptionDescribe(env);
11468 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
11470 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11471 CHECK_ACCESS(ret_ptr);
11472 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
11474 if (get_jenv_res == JNI_EDETACHED) {
11475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11479 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
11480 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
11481 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11483 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
11484 jclass c = (*env)->GetObjectClass(env, o);
11486 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
11487 atomic_init(&calls->refcnt, 1);
11488 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11489 calls->o = (*env)->NewWeakGlobalRef(env, o);
11490 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
11491 CHECK(calls->find_route_meth != NULL);
11494 .this_arg = (void*) calls,
11495 .find_route = find_route_LDKRouter_jcall,
11496 .free = LDKRouter_JCalls_free,
11500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
11501 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
11502 *res_ptr = LDKRouter_init(env, clz, o);
11503 return (uint64_t)res_ptr;
11505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
11506 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11508 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11509 LDKPublicKey payer_ref;
11510 CHECK((*env)->GetArrayLength(env, payer) == 33);
11511 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
11512 LDKRouteParameters params_conv;
11513 params_conv.inner = (void*)(params & (~1));
11514 params_conv.is_owned = false;
11515 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
11516 unsigned char payment_hash_arr[32];
11517 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11518 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
11519 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11520 LDKCVec_ChannelDetailsZ first_hops_constr;
11521 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11522 if (first_hops != NULL) {
11523 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
11524 if (first_hops_constr.datalen > 0)
11525 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11527 first_hops_constr.data = NULL;
11528 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
11529 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11530 int64_t first_hops_conv_16 = first_hops_vals[q];
11531 LDKChannelDetails first_hops_conv_16_conv;
11532 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
11533 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
11534 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11535 first_hops_constr.data[q] = first_hops_conv_16_conv;
11537 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
11538 first_hops_ptr = &first_hops_constr;
11540 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
11541 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
11542 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
11543 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11544 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
11545 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11546 return (uint64_t)ret_conv;
11549 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
11550 LDKStr ret_str = _ldk_get_compiled_version();
11551 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11556 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
11557 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11558 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11564 LDKTransaction _res_ref;
11565 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11566 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11567 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11568 _res_ref.data_is_owned = true;
11569 Transaction_free(_res_ref);
11572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
11573 LDKCVec_u8Z script_pubkey_ref;
11574 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
11575 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11576 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
11577 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11578 *ret_ref = TxOut_new(script_pubkey_ref, value);
11579 return (uint64_t)ret_ref;
11582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
11583 if ((_res & 1) != 0) return;
11584 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11585 CHECK_ACCESS(_res_ptr);
11586 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11588 TxOut_free(_res_conv);
11591 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11592 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11593 *ret_ref = TxOut_clone(arg);
11594 return (uint64_t)ret_ref;
11596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11597 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
11598 int64_t ret_val = TxOut_clone_ptr(arg_conv);
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11603 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
11604 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11605 *ret_ref = TxOut_clone(orig_conv);
11606 return (uint64_t)ret_ref;
11609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
11610 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11615 LDKSecretKey o_ref;
11616 CHECK((*env)->GetArrayLength(env, o) == 32);
11617 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
11618 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11619 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11620 return (uint64_t)ret_conv;
11623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11624 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11625 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11626 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11627 return (uint64_t)ret_conv;
11630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11631 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
11632 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
11636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11637 if ((_res & 1) != 0) return;
11638 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11639 CHECK_ACCESS(_res_ptr);
11640 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11642 CResult_SecretKeyErrorZ_free(_res_conv);
11645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11646 LDKPublicKey o_ref;
11647 CHECK((*env)->GetArrayLength(env, o) == 33);
11648 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
11649 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11650 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11651 return (uint64_t)ret_conv;
11654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11655 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11656 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11657 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11658 return (uint64_t)ret_conv;
11661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11662 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
11663 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
11667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11668 if ((_res & 1) != 0) return;
11669 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11670 CHECK_ACCESS(_res_ptr);
11671 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11673 CResult_PublicKeyErrorZ_free(_res_conv);
11676 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11677 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11678 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11679 return (uint64_t)ret_conv;
11681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11682 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
11683 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11688 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11689 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11690 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11691 return (uint64_t)ret_conv;
11694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11695 LDKTxCreationKeys o_conv;
11696 o_conv.inner = (void*)(o & (~1));
11697 o_conv.is_owned = (o & 1) || (o == 0);
11698 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11699 o_conv = TxCreationKeys_clone(&o_conv);
11700 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11701 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11702 return (uint64_t)ret_conv;
11705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11706 LDKDecodeError e_conv;
11707 e_conv.inner = (void*)(e & (~1));
11708 e_conv.is_owned = (e & 1) || (e == 0);
11709 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11710 e_conv = DecodeError_clone(&e_conv);
11711 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11712 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11713 return (uint64_t)ret_conv;
11716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11717 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
11718 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11723 if ((_res & 1) != 0) return;
11724 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11725 CHECK_ACCESS(_res_ptr);
11726 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11728 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11731 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11732 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11733 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11734 return (uint64_t)ret_conv;
11736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11737 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
11738 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11743 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11744 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11745 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11746 return (uint64_t)ret_conv;
11749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11750 LDKChannelPublicKeys o_conv;
11751 o_conv.inner = (void*)(o & (~1));
11752 o_conv.is_owned = (o & 1) || (o == 0);
11753 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11754 o_conv = ChannelPublicKeys_clone(&o_conv);
11755 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11756 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11757 return (uint64_t)ret_conv;
11760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11761 LDKDecodeError e_conv;
11762 e_conv.inner = (void*)(e & (~1));
11763 e_conv.is_owned = (e & 1) || (e == 0);
11764 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11765 e_conv = DecodeError_clone(&e_conv);
11766 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11767 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11768 return (uint64_t)ret_conv;
11771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11772 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
11773 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11778 if ((_res & 1) != 0) return;
11779 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11780 CHECK_ACCESS(_res_ptr);
11781 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11783 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11786 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11787 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11788 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11789 return (uint64_t)ret_conv;
11791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11792 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
11793 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11798 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11799 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11800 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11801 return (uint64_t)ret_conv;
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11805 LDKTxCreationKeys o_conv;
11806 o_conv.inner = (void*)(o & (~1));
11807 o_conv.is_owned = (o & 1) || (o == 0);
11808 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11809 o_conv = TxCreationKeys_clone(&o_conv);
11810 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11811 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11812 return (uint64_t)ret_conv;
11815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11816 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11817 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11818 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11819 return (uint64_t)ret_conv;
11822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11823 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
11824 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11829 if ((_res & 1) != 0) return;
11830 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11831 CHECK_ACCESS(_res_ptr);
11832 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11834 CResult_TxCreationKeysErrorZ_free(_res_conv);
11837 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11838 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11839 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11840 return (uint64_t)ret_conv;
11842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11843 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
11844 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11849 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11850 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11851 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11852 return (uint64_t)ret_conv;
11855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
11856 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11857 *ret_copy = COption_u32Z_some(o);
11858 uint64_t ret_ref = (uint64_t)ret_copy;
11862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
11863 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11864 *ret_copy = COption_u32Z_none();
11865 uint64_t ret_ref = (uint64_t)ret_copy;
11869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11870 if ((_res & 1) != 0) return;
11871 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11872 CHECK_ACCESS(_res_ptr);
11873 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11875 COption_u32Z_free(_res_conv);
11878 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11879 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11880 *ret_copy = COption_u32Z_clone(arg);
11881 uint64_t ret_ref = (uint64_t)ret_copy;
11884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11885 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
11886 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
11890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11891 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11892 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11893 *ret_copy = COption_u32Z_clone(orig_conv);
11894 uint64_t ret_ref = (uint64_t)ret_copy;
11898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11899 LDKHTLCOutputInCommitment o_conv;
11900 o_conv.inner = (void*)(o & (~1));
11901 o_conv.is_owned = (o & 1) || (o == 0);
11902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11903 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11904 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11905 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11906 return (uint64_t)ret_conv;
11909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11910 LDKDecodeError e_conv;
11911 e_conv.inner = (void*)(e & (~1));
11912 e_conv.is_owned = (e & 1) || (e == 0);
11913 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11914 e_conv = DecodeError_clone(&e_conv);
11915 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11916 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11917 return (uint64_t)ret_conv;
11920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11921 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
11922 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11927 if ((_res & 1) != 0) return;
11928 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11929 CHECK_ACCESS(_res_ptr);
11930 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11932 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11935 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11936 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11937 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11938 return (uint64_t)ret_conv;
11940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
11941 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
11942 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11947 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11948 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11949 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11950 return (uint64_t)ret_conv;
11953 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
11954 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
11958 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
11959 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
11963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
11964 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
11965 COption_NoneZ_free(_res_conv);
11968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11969 LDKCounterpartyChannelTransactionParameters o_conv;
11970 o_conv.inner = (void*)(o & (~1));
11971 o_conv.is_owned = (o & 1) || (o == 0);
11972 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11973 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11974 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11975 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11976 return (uint64_t)ret_conv;
11979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11980 LDKDecodeError e_conv;
11981 e_conv.inner = (void*)(e & (~1));
11982 e_conv.is_owned = (e & 1) || (e == 0);
11983 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11984 e_conv = DecodeError_clone(&e_conv);
11985 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11986 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11987 return (uint64_t)ret_conv;
11990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
11991 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11992 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11997 if ((_res & 1) != 0) return;
11998 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11999 CHECK_ACCESS(_res_ptr);
12000 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12002 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12005 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12006 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12007 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12008 return (uint64_t)ret_conv;
12010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12011 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
12012 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12017 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
12018 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12019 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12020 return (uint64_t)ret_conv;
12023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12024 LDKChannelTransactionParameters o_conv;
12025 o_conv.inner = (void*)(o & (~1));
12026 o_conv.is_owned = (o & 1) || (o == 0);
12027 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12028 o_conv = ChannelTransactionParameters_clone(&o_conv);
12029 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12030 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12031 return (uint64_t)ret_conv;
12034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12035 LDKDecodeError e_conv;
12036 e_conv.inner = (void*)(e & (~1));
12037 e_conv.is_owned = (e & 1) || (e == 0);
12038 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12039 e_conv = DecodeError_clone(&e_conv);
12040 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12041 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12042 return (uint64_t)ret_conv;
12045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12046 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
12047 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12052 if ((_res & 1) != 0) return;
12053 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12054 CHECK_ACCESS(_res_ptr);
12055 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12057 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12060 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12061 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12062 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12063 return (uint64_t)ret_conv;
12065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12066 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
12067 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12072 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
12073 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12074 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12075 return (uint64_t)ret_conv;
12078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12079 LDKCVec_SignatureZ _res_constr;
12080 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12081 if (_res_constr.datalen > 0)
12082 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12084 _res_constr.data = NULL;
12085 for (size_t i = 0; i < _res_constr.datalen; i++) {
12086 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12087 LDKSignature _res_conv_8_ref;
12088 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
12089 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
12090 _res_constr.data[i] = _res_conv_8_ref;
12092 CVec_SignatureZ_free(_res_constr);
12095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12096 LDKHolderCommitmentTransaction o_conv;
12097 o_conv.inner = (void*)(o & (~1));
12098 o_conv.is_owned = (o & 1) || (o == 0);
12099 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12100 o_conv = HolderCommitmentTransaction_clone(&o_conv);
12101 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12102 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12103 return (uint64_t)ret_conv;
12106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12107 LDKDecodeError e_conv;
12108 e_conv.inner = (void*)(e & (~1));
12109 e_conv.is_owned = (e & 1) || (e == 0);
12110 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12111 e_conv = DecodeError_clone(&e_conv);
12112 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12113 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12114 return (uint64_t)ret_conv;
12117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12118 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
12119 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12124 if ((_res & 1) != 0) return;
12125 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12126 CHECK_ACCESS(_res_ptr);
12127 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12129 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12132 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12133 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12134 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12135 return (uint64_t)ret_conv;
12137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12138 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
12139 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12144 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
12145 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12146 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12147 return (uint64_t)ret_conv;
12150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12151 LDKBuiltCommitmentTransaction o_conv;
12152 o_conv.inner = (void*)(o & (~1));
12153 o_conv.is_owned = (o & 1) || (o == 0);
12154 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12155 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12156 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12157 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12158 return (uint64_t)ret_conv;
12161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12162 LDKDecodeError e_conv;
12163 e_conv.inner = (void*)(e & (~1));
12164 e_conv.is_owned = (e & 1) || (e == 0);
12165 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12166 e_conv = DecodeError_clone(&e_conv);
12167 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12168 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12169 return (uint64_t)ret_conv;
12172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12173 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
12174 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12179 if ((_res & 1) != 0) return;
12180 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12181 CHECK_ACCESS(_res_ptr);
12182 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12184 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12187 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12188 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12189 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12190 return (uint64_t)ret_conv;
12192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12193 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
12194 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12199 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
12200 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12201 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12202 return (uint64_t)ret_conv;
12205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12206 LDKTrustedClosingTransaction o_conv;
12207 o_conv.inner = (void*)(o & (~1));
12208 o_conv.is_owned = (o & 1) || (o == 0);
12209 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12210 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
12211 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12212 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12213 return (uint64_t)ret_conv;
12216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
12217 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12218 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12219 return (uint64_t)ret_conv;
12222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12223 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
12224 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12229 if ((_res & 1) != 0) return;
12230 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12231 CHECK_ACCESS(_res_ptr);
12232 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12234 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12238 LDKCommitmentTransaction o_conv;
12239 o_conv.inner = (void*)(o & (~1));
12240 o_conv.is_owned = (o & 1) || (o == 0);
12241 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12242 o_conv = CommitmentTransaction_clone(&o_conv);
12243 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12244 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12245 return (uint64_t)ret_conv;
12248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12249 LDKDecodeError e_conv;
12250 e_conv.inner = (void*)(e & (~1));
12251 e_conv.is_owned = (e & 1) || (e == 0);
12252 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12253 e_conv = DecodeError_clone(&e_conv);
12254 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12255 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12256 return (uint64_t)ret_conv;
12259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12260 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
12261 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12266 if ((_res & 1) != 0) return;
12267 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12268 CHECK_ACCESS(_res_ptr);
12269 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12271 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12274 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12275 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12276 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12277 return (uint64_t)ret_conv;
12279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12280 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
12281 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12286 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
12287 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12288 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12289 return (uint64_t)ret_conv;
12292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12293 LDKTrustedCommitmentTransaction o_conv;
12294 o_conv.inner = (void*)(o & (~1));
12295 o_conv.is_owned = (o & 1) || (o == 0);
12296 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12297 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12298 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12299 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12300 return (uint64_t)ret_conv;
12303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
12304 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12305 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12306 return (uint64_t)ret_conv;
12309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12310 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
12311 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12316 if ((_res & 1) != 0) return;
12317 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12318 CHECK_ACCESS(_res_ptr);
12319 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12321 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
12325 LDKCVec_SignatureZ o_constr;
12326 o_constr.datalen = (*env)->GetArrayLength(env, o);
12327 if (o_constr.datalen > 0)
12328 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12330 o_constr.data = NULL;
12331 for (size_t i = 0; i < o_constr.datalen; i++) {
12332 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
12333 LDKSignature o_conv_8_ref;
12334 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
12335 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
12336 o_constr.data[i] = o_conv_8_ref;
12338 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12339 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12340 return (uint64_t)ret_conv;
12343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
12344 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12345 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12346 return (uint64_t)ret_conv;
12349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12350 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
12351 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12356 if ((_res & 1) != 0) return;
12357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12358 CHECK_ACCESS(_res_ptr);
12359 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12361 CResult_CVec_SignatureZNoneZ_free(_res_conv);
12364 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12365 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12366 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12367 return (uint64_t)ret_conv;
12369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12370 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
12371 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12376 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
12377 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12378 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12379 return (uint64_t)ret_conv;
12382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12383 LDKShutdownScript o_conv;
12384 o_conv.inner = (void*)(o & (~1));
12385 o_conv.is_owned = (o & 1) || (o == 0);
12386 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12387 o_conv = ShutdownScript_clone(&o_conv);
12388 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12389 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12390 return (uint64_t)ret_conv;
12393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12394 LDKDecodeError e_conv;
12395 e_conv.inner = (void*)(e & (~1));
12396 e_conv.is_owned = (e & 1) || (e == 0);
12397 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12398 e_conv = DecodeError_clone(&e_conv);
12399 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12400 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12401 return (uint64_t)ret_conv;
12404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12405 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
12406 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12411 if ((_res & 1) != 0) return;
12412 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12413 CHECK_ACCESS(_res_ptr);
12414 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12416 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12419 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12420 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12421 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12422 return (uint64_t)ret_conv;
12424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12425 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
12426 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12431 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
12432 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12433 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12434 return (uint64_t)ret_conv;
12437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12438 LDKShutdownScript o_conv;
12439 o_conv.inner = (void*)(o & (~1));
12440 o_conv.is_owned = (o & 1) || (o == 0);
12441 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12442 o_conv = ShutdownScript_clone(&o_conv);
12443 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12444 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12445 return (uint64_t)ret_conv;
12448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12449 LDKInvalidShutdownScript e_conv;
12450 e_conv.inner = (void*)(e & (~1));
12451 e_conv.is_owned = (e & 1) || (e == 0);
12452 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12453 e_conv = InvalidShutdownScript_clone(&e_conv);
12454 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12455 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12456 return (uint64_t)ret_conv;
12459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12460 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
12461 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12466 if ((_res & 1) != 0) return;
12467 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12468 CHECK_ACCESS(_res_ptr);
12469 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12471 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12474 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12475 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12476 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12477 return (uint64_t)ret_conv;
12479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12480 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
12481 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12486 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
12487 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12488 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12489 return (uint64_t)ret_conv;
12492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
12493 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12494 *ret_conv = CResult_NoneErrorZ_ok();
12495 return (uint64_t)ret_conv;
12498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12499 LDKIOError e_conv = LDKIOError_from_java(env, e);
12500 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12501 *ret_conv = CResult_NoneErrorZ_err(e_conv);
12502 return (uint64_t)ret_conv;
12505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12506 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
12507 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
12511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12512 if ((_res & 1) != 0) return;
12513 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12514 CHECK_ACCESS(_res_ptr);
12515 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
12517 CResult_NoneErrorZ_free(_res_conv);
12520 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
12521 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12522 *ret_conv = CResult_NoneErrorZ_clone(arg);
12523 return (uint64_t)ret_conv;
12525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12526 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
12527 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
12531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12532 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
12533 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12534 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
12535 return (uint64_t)ret_conv;
12538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12539 LDKRouteHop o_conv;
12540 o_conv.inner = (void*)(o & (~1));
12541 o_conv.is_owned = (o & 1) || (o == 0);
12542 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12543 o_conv = RouteHop_clone(&o_conv);
12544 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12545 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12546 return (uint64_t)ret_conv;
12549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_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 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12554 e_conv = DecodeError_clone(&e_conv);
12555 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12556 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12557 return (uint64_t)ret_conv;
12560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12561 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
12562 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12567 if ((_res & 1) != 0) return;
12568 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12569 CHECK_ACCESS(_res_ptr);
12570 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12572 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12575 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12576 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12577 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12578 return (uint64_t)ret_conv;
12580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12581 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
12582 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12587 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12588 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12589 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12590 return (uint64_t)ret_conv;
12593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12594 LDKCVec_RouteHopZ _res_constr;
12595 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12596 if (_res_constr.datalen > 0)
12597 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12599 _res_constr.data = NULL;
12600 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12601 for (size_t k = 0; k < _res_constr.datalen; k++) {
12602 int64_t _res_conv_10 = _res_vals[k];
12603 LDKRouteHop _res_conv_10_conv;
12604 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12605 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12606 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12607 _res_constr.data[k] = _res_conv_10_conv;
12609 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12610 CVec_RouteHopZ_free(_res_constr);
12613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12614 LDKCVec_CVec_RouteHopZZ _res_constr;
12615 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12616 if (_res_constr.datalen > 0)
12617 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12619 _res_constr.data = NULL;
12620 for (size_t m = 0; m < _res_constr.datalen; m++) {
12621 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
12622 LDKCVec_RouteHopZ _res_conv_12_constr;
12623 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
12624 if (_res_conv_12_constr.datalen > 0)
12625 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12627 _res_conv_12_constr.data = NULL;
12628 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
12629 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12630 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12631 LDKRouteHop _res_conv_12_conv_10_conv;
12632 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12633 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12634 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12635 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12637 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
12638 _res_constr.data[m] = _res_conv_12_constr;
12640 CVec_CVec_RouteHopZZ_free(_res_constr);
12643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12645 o_conv.inner = (void*)(o & (~1));
12646 o_conv.is_owned = (o & 1) || (o == 0);
12647 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12648 o_conv = Route_clone(&o_conv);
12649 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12650 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12651 return (uint64_t)ret_conv;
12654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12655 LDKDecodeError e_conv;
12656 e_conv.inner = (void*)(e & (~1));
12657 e_conv.is_owned = (e & 1) || (e == 0);
12658 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12659 e_conv = DecodeError_clone(&e_conv);
12660 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12661 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12662 return (uint64_t)ret_conv;
12665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12666 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
12667 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12672 if ((_res & 1) != 0) return;
12673 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12674 CHECK_ACCESS(_res_ptr);
12675 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12677 CResult_RouteDecodeErrorZ_free(_res_conv);
12680 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12681 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12682 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12683 return (uint64_t)ret_conv;
12685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12686 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
12687 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12692 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12693 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12694 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12695 return (uint64_t)ret_conv;
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12699 LDKRouteParameters o_conv;
12700 o_conv.inner = (void*)(o & (~1));
12701 o_conv.is_owned = (o & 1) || (o == 0);
12702 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12703 o_conv = RouteParameters_clone(&o_conv);
12704 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12705 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12706 return (uint64_t)ret_conv;
12709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12710 LDKDecodeError e_conv;
12711 e_conv.inner = (void*)(e & (~1));
12712 e_conv.is_owned = (e & 1) || (e == 0);
12713 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12714 e_conv = DecodeError_clone(&e_conv);
12715 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12716 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12717 return (uint64_t)ret_conv;
12720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12721 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
12722 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12727 if ((_res & 1) != 0) return;
12728 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12729 CHECK_ACCESS(_res_ptr);
12730 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12732 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12735 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12736 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12737 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12738 return (uint64_t)ret_conv;
12740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12741 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
12742 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12747 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12748 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12749 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12750 return (uint64_t)ret_conv;
12753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12754 LDKCVec_RouteHintZ _res_constr;
12755 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12756 if (_res_constr.datalen > 0)
12757 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12759 _res_constr.data = NULL;
12760 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12761 for (size_t l = 0; l < _res_constr.datalen; l++) {
12762 int64_t _res_conv_11 = _res_vals[l];
12763 LDKRouteHint _res_conv_11_conv;
12764 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12765 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12766 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12767 _res_constr.data[l] = _res_conv_11_conv;
12769 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12770 CVec_RouteHintZ_free(_res_constr);
12773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
12774 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12775 *ret_copy = COption_u64Z_some(o);
12776 uint64_t ret_ref = (uint64_t)ret_copy;
12780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
12781 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12782 *ret_copy = COption_u64Z_none();
12783 uint64_t ret_ref = (uint64_t)ret_copy;
12787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12788 if ((_res & 1) != 0) return;
12789 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12790 CHECK_ACCESS(_res_ptr);
12791 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12793 COption_u64Z_free(_res_conv);
12796 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12797 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12798 *ret_copy = COption_u64Z_clone(arg);
12799 uint64_t ret_ref = (uint64_t)ret_copy;
12802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12803 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
12804 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
12808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12809 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12810 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12811 *ret_copy = COption_u64Z_clone(orig_conv);
12812 uint64_t ret_ref = (uint64_t)ret_copy;
12816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12818 o_conv.inner = (void*)(o & (~1));
12819 o_conv.is_owned = (o & 1) || (o == 0);
12820 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12821 o_conv = Payee_clone(&o_conv);
12822 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12823 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
12824 return (uint64_t)ret_conv;
12827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12828 LDKDecodeError e_conv;
12829 e_conv.inner = (void*)(e & (~1));
12830 e_conv.is_owned = (e & 1) || (e == 0);
12831 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12832 e_conv = DecodeError_clone(&e_conv);
12833 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12834 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
12835 return (uint64_t)ret_conv;
12838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12839 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
12840 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
12844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12845 if ((_res & 1) != 0) return;
12846 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12847 CHECK_ACCESS(_res_ptr);
12848 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
12850 CResult_PayeeDecodeErrorZ_free(_res_conv);
12853 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
12854 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12855 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
12856 return (uint64_t)ret_conv;
12858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12859 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
12860 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
12864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12865 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
12866 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12867 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
12868 return (uint64_t)ret_conv;
12871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12872 LDKCVec_RouteHintHopZ _res_constr;
12873 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12874 if (_res_constr.datalen > 0)
12875 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12877 _res_constr.data = NULL;
12878 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12879 for (size_t o = 0; o < _res_constr.datalen; o++) {
12880 int64_t _res_conv_14 = _res_vals[o];
12881 LDKRouteHintHop _res_conv_14_conv;
12882 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12883 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12884 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12885 _res_constr.data[o] = _res_conv_14_conv;
12887 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12888 CVec_RouteHintHopZ_free(_res_constr);
12891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12892 LDKRouteHint o_conv;
12893 o_conv.inner = (void*)(o & (~1));
12894 o_conv.is_owned = (o & 1) || (o == 0);
12895 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12896 o_conv = RouteHint_clone(&o_conv);
12897 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12898 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12899 return (uint64_t)ret_conv;
12902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12903 LDKDecodeError e_conv;
12904 e_conv.inner = (void*)(e & (~1));
12905 e_conv.is_owned = (e & 1) || (e == 0);
12906 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12907 e_conv = DecodeError_clone(&e_conv);
12908 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12909 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12910 return (uint64_t)ret_conv;
12913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12914 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
12915 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12920 if ((_res & 1) != 0) return;
12921 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12922 CHECK_ACCESS(_res_ptr);
12923 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12925 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12928 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12929 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12930 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12931 return (uint64_t)ret_conv;
12933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12934 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
12935 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12940 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12941 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12942 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12943 return (uint64_t)ret_conv;
12946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12947 LDKRouteHintHop o_conv;
12948 o_conv.inner = (void*)(o & (~1));
12949 o_conv.is_owned = (o & 1) || (o == 0);
12950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12951 o_conv = RouteHintHop_clone(&o_conv);
12952 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12953 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12954 return (uint64_t)ret_conv;
12957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12958 LDKDecodeError e_conv;
12959 e_conv.inner = (void*)(e & (~1));
12960 e_conv.is_owned = (e & 1) || (e == 0);
12961 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12962 e_conv = DecodeError_clone(&e_conv);
12963 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12964 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12965 return (uint64_t)ret_conv;
12968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
12969 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
12970 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12975 if ((_res & 1) != 0) return;
12976 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12977 CHECK_ACCESS(_res_ptr);
12978 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12980 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12983 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12984 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12985 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12986 return (uint64_t)ret_conv;
12988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
12989 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
12990 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12995 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12996 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12997 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12998 return (uint64_t)ret_conv;
13001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13002 LDKCVec_ChannelDetailsZ _res_constr;
13003 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13004 if (_res_constr.datalen > 0)
13005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13007 _res_constr.data = NULL;
13008 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13009 for (size_t q = 0; q < _res_constr.datalen; q++) {
13010 int64_t _res_conv_16 = _res_vals[q];
13011 LDKChannelDetails _res_conv_16_conv;
13012 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13013 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13014 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
13015 _res_constr.data[q] = _res_conv_16_conv;
13017 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13018 CVec_ChannelDetailsZ_free(_res_constr);
13021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13023 o_conv.inner = (void*)(o & (~1));
13024 o_conv.is_owned = (o & 1) || (o == 0);
13025 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13026 o_conv = Route_clone(&o_conv);
13027 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13028 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
13029 return (uint64_t)ret_conv;
13032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13033 LDKLightningError e_conv;
13034 e_conv.inner = (void*)(e & (~1));
13035 e_conv.is_owned = (e & 1) || (e == 0);
13036 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13037 e_conv = LightningError_clone(&e_conv);
13038 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13039 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
13040 return (uint64_t)ret_conv;
13043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13044 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
13045 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
13049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13050 if ((_res & 1) != 0) return;
13051 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13052 CHECK_ACCESS(_res_ptr);
13053 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
13055 CResult_RouteLightningErrorZ_free(_res_conv);
13058 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
13059 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13060 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
13061 return (uint64_t)ret_conv;
13063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13064 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
13065 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
13069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13070 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
13071 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13072 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
13073 return (uint64_t)ret_conv;
13076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13077 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13078 CHECK_ACCESS(o_ptr);
13079 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13080 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
13081 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13082 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13083 return (uint64_t)ret_conv;
13086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13087 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
13088 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13089 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13090 return (uint64_t)ret_conv;
13093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13094 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
13095 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13100 if ((_res & 1) != 0) return;
13101 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13102 CHECK_ACCESS(_res_ptr);
13103 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13105 CResult_TxOutAccessErrorZ_free(_res_conv);
13108 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13109 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13110 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13111 return (uint64_t)ret_conv;
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13114 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
13115 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13120 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
13121 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13122 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13123 return (uint64_t)ret_conv;
13126 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13127 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13128 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13129 return ((uint64_t)ret_conv);
13131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13132 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
13133 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13138 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
13139 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13140 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13141 return ((uint64_t)ret_conv);
13144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
13145 LDKTransaction b_ref;
13146 b_ref.datalen = (*env)->GetArrayLength(env, b);
13147 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13148 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
13149 b_ref.data_is_owned = true;
13150 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13151 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13152 return ((uint64_t)ret_conv);
13155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13156 if ((_res & 1) != 0) return;
13157 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13158 CHECK_ACCESS(_res_ptr);
13159 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13161 C2Tuple_usizeTransactionZ_free(_res_conv);
13164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13165 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13166 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13167 if (_res_constr.datalen > 0)
13168 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13170 _res_constr.data = NULL;
13171 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13172 for (size_t c = 0; c < _res_constr.datalen; c++) {
13173 int64_t _res_conv_28 = _res_vals[c];
13174 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
13175 CHECK_ACCESS(_res_conv_28_ptr);
13176 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13177 FREE((void*)_res_conv_28);
13178 _res_constr.data[c] = _res_conv_28_conv;
13180 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13181 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13185 LDKCVec_TxidZ _res_constr;
13186 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13187 if (_res_constr.datalen > 0)
13188 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13190 _res_constr.data = NULL;
13191 for (size_t i = 0; i < _res_constr.datalen; i++) {
13192 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13193 LDKThirtyTwoBytes _res_conv_8_ref;
13194 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
13195 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
13196 _res_constr.data[i] = _res_conv_8_ref;
13198 CVec_TxidZ_free(_res_constr);
13201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
13202 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13203 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13204 return (uint64_t)ret_conv;
13207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
13208 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
13209 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13210 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13211 return (uint64_t)ret_conv;
13214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13215 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
13216 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13221 if ((_res & 1) != 0) return;
13222 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13223 CHECK_ACCESS(_res_ptr);
13224 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13226 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13229 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13230 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13231 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13232 return (uint64_t)ret_conv;
13234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13235 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
13236 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13241 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
13242 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13243 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13244 return (uint64_t)ret_conv;
13247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13248 LDKCVec_MonitorEventZ _res_constr;
13249 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13250 if (_res_constr.datalen > 0)
13251 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13253 _res_constr.data = NULL;
13254 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13255 for (size_t o = 0; o < _res_constr.datalen; o++) {
13256 int64_t _res_conv_14 = _res_vals[o];
13257 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
13258 CHECK_ACCESS(_res_conv_14_ptr);
13259 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13260 FREE((void*)_res_conv_14);
13261 _res_constr.data[o] = _res_conv_14_conv;
13263 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13264 CVec_MonitorEventZ_free(_res_constr);
13267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13268 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13269 CHECK_ACCESS(o_ptr);
13270 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
13271 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
13272 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13273 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
13274 uint64_t ret_ref = (uint64_t)ret_copy;
13278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
13279 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13280 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
13281 uint64_t ret_ref = (uint64_t)ret_copy;
13285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13286 if ((_res & 1) != 0) return;
13287 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13288 CHECK_ACCESS(_res_ptr);
13289 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
13291 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
13294 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
13295 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13296 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
13297 uint64_t ret_ref = (uint64_t)ret_copy;
13300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13301 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
13302 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
13306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13307 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
13308 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13309 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
13310 uint64_t ret_ref = (uint64_t)ret_copy;
13314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13315 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13316 CHECK_ACCESS(o_ptr);
13317 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13318 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
13319 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13320 *ret_copy = COption_ClosureReasonZ_some(o_conv);
13321 uint64_t ret_ref = (uint64_t)ret_copy;
13325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
13326 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13327 *ret_copy = COption_ClosureReasonZ_none();
13328 uint64_t ret_ref = (uint64_t)ret_copy;
13332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13333 if ((_res & 1) != 0) return;
13334 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13335 CHECK_ACCESS(_res_ptr);
13336 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13338 COption_ClosureReasonZ_free(_res_conv);
13341 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13342 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13343 *ret_copy = COption_ClosureReasonZ_clone(arg);
13344 uint64_t ret_ref = (uint64_t)ret_copy;
13347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13348 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
13349 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
13353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13354 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
13355 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13356 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13357 uint64_t ret_ref = (uint64_t)ret_copy;
13361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13362 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13363 CHECK_ACCESS(o_ptr);
13364 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13365 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
13366 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13367 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13368 return (uint64_t)ret_conv;
13371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13372 LDKDecodeError e_conv;
13373 e_conv.inner = (void*)(e & (~1));
13374 e_conv.is_owned = (e & 1) || (e == 0);
13375 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13376 e_conv = DecodeError_clone(&e_conv);
13377 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13378 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13379 return (uint64_t)ret_conv;
13382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13383 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
13384 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13389 if ((_res & 1) != 0) return;
13390 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13391 CHECK_ACCESS(_res_ptr);
13392 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13394 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13397 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13398 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13399 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13400 return (uint64_t)ret_conv;
13402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13403 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
13404 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13409 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
13410 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13411 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13412 return (uint64_t)ret_conv;
13415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13416 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13417 CHECK_ACCESS(o_ptr);
13418 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13419 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
13420 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13421 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13422 uint64_t ret_ref = (uint64_t)ret_copy;
13426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
13427 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13428 *ret_copy = COption_NetworkUpdateZ_none();
13429 uint64_t ret_ref = (uint64_t)ret_copy;
13433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13434 if ((_res & 1) != 0) return;
13435 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13436 CHECK_ACCESS(_res_ptr);
13437 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13439 COption_NetworkUpdateZ_free(_res_conv);
13442 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13443 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13444 *ret_copy = COption_NetworkUpdateZ_clone(arg);
13445 uint64_t ret_ref = (uint64_t)ret_copy;
13448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13449 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
13450 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13455 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
13456 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13457 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13458 uint64_t ret_ref = (uint64_t)ret_copy;
13462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13463 LDKCVec_SpendableOutputDescriptorZ _res_constr;
13464 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13465 if (_res_constr.datalen > 0)
13466 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13468 _res_constr.data = NULL;
13469 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13470 for (size_t b = 0; b < _res_constr.datalen; b++) {
13471 int64_t _res_conv_27 = _res_vals[b];
13472 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
13473 CHECK_ACCESS(_res_conv_27_ptr);
13474 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13475 FREE((void*)_res_conv_27);
13476 _res_constr.data[b] = _res_conv_27_conv;
13478 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13479 CVec_SpendableOutputDescriptorZ_free(_res_constr);
13482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13483 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13484 CHECK_ACCESS(o_ptr);
13485 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13486 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
13487 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13488 *ret_copy = COption_EventZ_some(o_conv);
13489 uint64_t ret_ref = (uint64_t)ret_copy;
13493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
13494 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13495 *ret_copy = COption_EventZ_none();
13496 uint64_t ret_ref = (uint64_t)ret_copy;
13500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13501 if ((_res & 1) != 0) return;
13502 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13503 CHECK_ACCESS(_res_ptr);
13504 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13506 COption_EventZ_free(_res_conv);
13509 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13510 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13511 *ret_copy = COption_EventZ_clone(arg);
13512 uint64_t ret_ref = (uint64_t)ret_copy;
13515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13516 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
13517 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
13521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13522 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
13523 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13524 *ret_copy = COption_EventZ_clone(orig_conv);
13525 uint64_t ret_ref = (uint64_t)ret_copy;
13529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13530 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13531 CHECK_ACCESS(o_ptr);
13532 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13533 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
13534 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13535 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13536 return (uint64_t)ret_conv;
13539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13540 LDKDecodeError e_conv;
13541 e_conv.inner = (void*)(e & (~1));
13542 e_conv.is_owned = (e & 1) || (e == 0);
13543 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13544 e_conv = DecodeError_clone(&e_conv);
13545 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13546 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13547 return (uint64_t)ret_conv;
13550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13551 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
13552 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13557 if ((_res & 1) != 0) return;
13558 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13559 CHECK_ACCESS(_res_ptr);
13560 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13562 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13565 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13566 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13567 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13568 return (uint64_t)ret_conv;
13570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13571 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
13572 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13577 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
13578 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13579 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13580 return (uint64_t)ret_conv;
13583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13584 LDKCVec_MessageSendEventZ _res_constr;
13585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13586 if (_res_constr.datalen > 0)
13587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13589 _res_constr.data = NULL;
13590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13591 for (size_t s = 0; s < _res_constr.datalen; s++) {
13592 int64_t _res_conv_18 = _res_vals[s];
13593 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
13594 CHECK_ACCESS(_res_conv_18_ptr);
13595 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13596 FREE((void*)_res_conv_18);
13597 _res_constr.data[s] = _res_conv_18_conv;
13599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13600 CVec_MessageSendEventZ_free(_res_constr);
13603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13604 LDKScoringParameters o_conv;
13605 o_conv.inner = (void*)(o & (~1));
13606 o_conv.is_owned = (o & 1) || (o == 0);
13607 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13608 // Warning: we need a move here but no clone is available for LDKScoringParameters
13609 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
13610 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
13611 return (uint64_t)ret_conv;
13614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13615 LDKDecodeError e_conv;
13616 e_conv.inner = (void*)(e & (~1));
13617 e_conv.is_owned = (e & 1) || (e == 0);
13618 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13619 e_conv = DecodeError_clone(&e_conv);
13620 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
13621 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
13622 return (uint64_t)ret_conv;
13625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13626 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
13627 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
13631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13632 if ((_res & 1) != 0) return;
13633 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13634 CHECK_ACCESS(_res_ptr);
13635 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
13637 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
13640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13642 o_conv.inner = (void*)(o & (~1));
13643 o_conv.is_owned = (o & 1) || (o == 0);
13644 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13645 // Warning: we need a move here but no clone is available for LDKScorer
13646 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
13647 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
13648 return (uint64_t)ret_conv;
13651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13652 LDKDecodeError e_conv;
13653 e_conv.inner = (void*)(e & (~1));
13654 e_conv.is_owned = (e & 1) || (e == 0);
13655 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13656 e_conv = DecodeError_clone(&e_conv);
13657 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
13658 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
13659 return (uint64_t)ret_conv;
13662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13663 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
13664 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
13668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13669 if ((_res & 1) != 0) return;
13670 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13671 CHECK_ACCESS(_res_ptr);
13672 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
13674 CResult_ScorerDecodeErrorZ_free(_res_conv);
13677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13678 LDKInitFeatures o_conv;
13679 o_conv.inner = (void*)(o & (~1));
13680 o_conv.is_owned = (o & 1) || (o == 0);
13681 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13682 o_conv = InitFeatures_clone(&o_conv);
13683 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13684 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13685 return (uint64_t)ret_conv;
13688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13689 LDKDecodeError e_conv;
13690 e_conv.inner = (void*)(e & (~1));
13691 e_conv.is_owned = (e & 1) || (e == 0);
13692 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13693 e_conv = DecodeError_clone(&e_conv);
13694 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13695 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13696 return (uint64_t)ret_conv;
13699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13700 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
13701 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13706 if ((_res & 1) != 0) return;
13707 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13708 CHECK_ACCESS(_res_ptr);
13709 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13711 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13715 LDKChannelFeatures o_conv;
13716 o_conv.inner = (void*)(o & (~1));
13717 o_conv.is_owned = (o & 1) || (o == 0);
13718 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13719 o_conv = ChannelFeatures_clone(&o_conv);
13720 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13721 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13722 return (uint64_t)ret_conv;
13725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13726 LDKDecodeError e_conv;
13727 e_conv.inner = (void*)(e & (~1));
13728 e_conv.is_owned = (e & 1) || (e == 0);
13729 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13730 e_conv = DecodeError_clone(&e_conv);
13731 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13732 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13733 return (uint64_t)ret_conv;
13736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13737 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
13738 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13743 if ((_res & 1) != 0) return;
13744 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13745 CHECK_ACCESS(_res_ptr);
13746 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13748 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13752 LDKNodeFeatures o_conv;
13753 o_conv.inner = (void*)(o & (~1));
13754 o_conv.is_owned = (o & 1) || (o == 0);
13755 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13756 o_conv = NodeFeatures_clone(&o_conv);
13757 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13758 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13759 return (uint64_t)ret_conv;
13762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13763 LDKDecodeError e_conv;
13764 e_conv.inner = (void*)(e & (~1));
13765 e_conv.is_owned = (e & 1) || (e == 0);
13766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13767 e_conv = DecodeError_clone(&e_conv);
13768 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13769 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13770 return (uint64_t)ret_conv;
13773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13774 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
13775 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13780 if ((_res & 1) != 0) return;
13781 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13782 CHECK_ACCESS(_res_ptr);
13783 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13785 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13789 LDKInvoiceFeatures o_conv;
13790 o_conv.inner = (void*)(o & (~1));
13791 o_conv.is_owned = (o & 1) || (o == 0);
13792 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13793 o_conv = InvoiceFeatures_clone(&o_conv);
13794 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13795 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13796 return (uint64_t)ret_conv;
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13800 LDKDecodeError e_conv;
13801 e_conv.inner = (void*)(e & (~1));
13802 e_conv.is_owned = (e & 1) || (e == 0);
13803 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13804 e_conv = DecodeError_clone(&e_conv);
13805 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13806 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13807 return (uint64_t)ret_conv;
13810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13811 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
13812 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13817 if ((_res & 1) != 0) return;
13818 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13819 CHECK_ACCESS(_res_ptr);
13820 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13822 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13826 LDKChannelTypeFeatures o_conv;
13827 o_conv.inner = (void*)(o & (~1));
13828 o_conv.is_owned = (o & 1) || (o == 0);
13829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13830 o_conv = ChannelTypeFeatures_clone(&o_conv);
13831 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13832 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
13833 return (uint64_t)ret_conv;
13836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13837 LDKDecodeError e_conv;
13838 e_conv.inner = (void*)(e & (~1));
13839 e_conv.is_owned = (e & 1) || (e == 0);
13840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13841 e_conv = DecodeError_clone(&e_conv);
13842 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13843 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
13844 return (uint64_t)ret_conv;
13847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13848 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
13849 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13854 if ((_res & 1) != 0) return;
13855 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13856 CHECK_ACCESS(_res_ptr);
13857 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13859 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13863 LDKDelayedPaymentOutputDescriptor o_conv;
13864 o_conv.inner = (void*)(o & (~1));
13865 o_conv.is_owned = (o & 1) || (o == 0);
13866 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13867 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
13868 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13869 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13870 return (uint64_t)ret_conv;
13873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13874 LDKDecodeError e_conv;
13875 e_conv.inner = (void*)(e & (~1));
13876 e_conv.is_owned = (e & 1) || (e == 0);
13877 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13878 e_conv = DecodeError_clone(&e_conv);
13879 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13880 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13881 return (uint64_t)ret_conv;
13884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13885 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
13886 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13891 if ((_res & 1) != 0) return;
13892 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13893 CHECK_ACCESS(_res_ptr);
13894 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13896 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13899 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13900 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13901 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13902 return (uint64_t)ret_conv;
13904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13905 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
13906 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13911 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13912 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13913 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13914 return (uint64_t)ret_conv;
13917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13918 LDKStaticPaymentOutputDescriptor o_conv;
13919 o_conv.inner = (void*)(o & (~1));
13920 o_conv.is_owned = (o & 1) || (o == 0);
13921 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13922 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
13923 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13924 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13925 return (uint64_t)ret_conv;
13928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13929 LDKDecodeError e_conv;
13930 e_conv.inner = (void*)(e & (~1));
13931 e_conv.is_owned = (e & 1) || (e == 0);
13932 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13933 e_conv = DecodeError_clone(&e_conv);
13934 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13935 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13936 return (uint64_t)ret_conv;
13939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13940 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
13941 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13946 if ((_res & 1) != 0) return;
13947 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13948 CHECK_ACCESS(_res_ptr);
13949 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13951 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13954 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13955 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13956 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13957 return (uint64_t)ret_conv;
13959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13960 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
13961 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13966 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13967 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13968 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13969 return (uint64_t)ret_conv;
13972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13973 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13974 CHECK_ACCESS(o_ptr);
13975 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
13976 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
13977 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13978 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
13979 return (uint64_t)ret_conv;
13982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13983 LDKDecodeError e_conv;
13984 e_conv.inner = (void*)(e & (~1));
13985 e_conv.is_owned = (e & 1) || (e == 0);
13986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13987 e_conv = DecodeError_clone(&e_conv);
13988 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13989 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
13990 return (uint64_t)ret_conv;
13993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13994 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
13995 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14000 if ((_res & 1) != 0) return;
14001 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14002 CHECK_ACCESS(_res_ptr);
14003 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14005 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14008 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14009 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14010 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14011 return (uint64_t)ret_conv;
14013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14014 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14015 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14020 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14021 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14022 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14023 return (uint64_t)ret_conv;
14026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14027 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14028 *ret_conv = CResult_NoneNoneZ_ok();
14029 return (uint64_t)ret_conv;
14032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14033 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14034 *ret_conv = CResult_NoneNoneZ_err();
14035 return (uint64_t)ret_conv;
14038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14039 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14040 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
14044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14045 if ((_res & 1) != 0) return;
14046 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14047 CHECK_ACCESS(_res_ptr);
14048 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14050 CResult_NoneNoneZ_free(_res_conv);
14053 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14054 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14055 *ret_conv = CResult_NoneNoneZ_clone(arg);
14056 return (uint64_t)ret_conv;
14058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14059 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14060 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
14064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14065 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14066 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14067 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14068 return (uint64_t)ret_conv;
14071 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14072 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14073 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14074 return ((uint64_t)ret_conv);
14076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14077 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14078 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14083 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14084 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14085 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14086 return ((uint64_t)ret_conv);
14089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
14090 LDKSignature a_ref;
14091 CHECK((*env)->GetArrayLength(env, a) == 64);
14092 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
14093 LDKCVec_SignatureZ b_constr;
14094 b_constr.datalen = (*env)->GetArrayLength(env, b);
14095 if (b_constr.datalen > 0)
14096 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14098 b_constr.data = NULL;
14099 for (size_t i = 0; i < b_constr.datalen; i++) {
14100 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
14101 LDKSignature b_conv_8_ref;
14102 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
14103 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
14104 b_constr.data[i] = b_conv_8_ref;
14106 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14107 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14108 return ((uint64_t)ret_conv);
14111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14112 if ((_res & 1) != 0) return;
14113 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14114 CHECK_ACCESS(_res_ptr);
14115 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14117 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14121 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14122 CHECK_ACCESS(o_ptr);
14123 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14124 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
14125 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14126 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14127 return (uint64_t)ret_conv;
14130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
14131 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14132 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14133 return (uint64_t)ret_conv;
14136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14137 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14138 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14143 if ((_res & 1) != 0) return;
14144 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14145 CHECK_ACCESS(_res_ptr);
14146 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14148 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14151 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14152 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14153 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14154 return (uint64_t)ret_conv;
14156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14157 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14158 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14163 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14164 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14165 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14166 return (uint64_t)ret_conv;
14169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14170 LDKSignature o_ref;
14171 CHECK((*env)->GetArrayLength(env, o) == 64);
14172 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
14173 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14174 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14175 return (uint64_t)ret_conv;
14178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
14179 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14180 *ret_conv = CResult_SignatureNoneZ_err();
14181 return (uint64_t)ret_conv;
14184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14185 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14186 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
14190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14191 if ((_res & 1) != 0) return;
14192 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14193 CHECK_ACCESS(_res_ptr);
14194 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14196 CResult_SignatureNoneZ_free(_res_conv);
14199 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14200 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14201 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14202 return (uint64_t)ret_conv;
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14205 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14206 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14211 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14212 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14213 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14214 return (uint64_t)ret_conv;
14217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14218 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14219 CHECK_ACCESS(o_ptr);
14220 LDKSign o_conv = *(LDKSign*)(o_ptr);
14221 if (o_conv.free == LDKSign_JCalls_free) {
14222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14223 LDKSign_JCalls_cloned(&o_conv);
14225 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14226 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14227 return (uint64_t)ret_conv;
14230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14231 LDKDecodeError e_conv;
14232 e_conv.inner = (void*)(e & (~1));
14233 e_conv.is_owned = (e & 1) || (e == 0);
14234 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14235 e_conv = DecodeError_clone(&e_conv);
14236 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14237 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14238 return (uint64_t)ret_conv;
14241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14242 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14243 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
14247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14248 if ((_res & 1) != 0) return;
14249 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14250 CHECK_ACCESS(_res_ptr);
14251 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14253 CResult_SignDecodeErrorZ_free(_res_conv);
14256 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14257 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14258 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14259 return (uint64_t)ret_conv;
14261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14262 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14263 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14268 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14269 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14270 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14271 return (uint64_t)ret_conv;
14274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14275 LDKCVec_u8Z _res_ref;
14276 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14277 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14278 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14279 CVec_u8Z_free(_res_ref);
14282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
14283 LDKRecoverableSignature arg_ref;
14284 CHECK((*env)->GetArrayLength(env, arg) == 68);
14285 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
14286 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14287 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
14288 return (uint64_t)ret_conv;
14291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
14292 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14293 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14294 return (uint64_t)ret_conv;
14297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14298 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14299 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14304 if ((_res & 1) != 0) return;
14305 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14306 CHECK_ACCESS(_res_ptr);
14307 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14309 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14312 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14313 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14314 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14315 return (uint64_t)ret_conv;
14317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14318 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14319 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14324 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14325 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14326 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14327 return (uint64_t)ret_conv;
14330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14331 LDKCVec_CVec_u8ZZ _res_constr;
14332 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14333 if (_res_constr.datalen > 0)
14334 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14336 _res_constr.data = NULL;
14337 for (size_t i = 0; i < _res_constr.datalen; i++) {
14338 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14339 LDKCVec_u8Z _res_conv_8_ref;
14340 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
14341 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
14342 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
14343 _res_constr.data[i] = _res_conv_8_ref;
14345 CVec_CVec_u8ZZ_free(_res_constr);
14348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14349 LDKCVec_CVec_u8ZZ o_constr;
14350 o_constr.datalen = (*env)->GetArrayLength(env, o);
14351 if (o_constr.datalen > 0)
14352 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14354 o_constr.data = NULL;
14355 for (size_t i = 0; i < o_constr.datalen; i++) {
14356 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14357 LDKCVec_u8Z o_conv_8_ref;
14358 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
14359 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
14360 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
14361 o_constr.data[i] = o_conv_8_ref;
14363 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14364 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14365 return (uint64_t)ret_conv;
14368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
14369 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14370 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14371 return (uint64_t)ret_conv;
14374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14375 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
14376 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14381 if ((_res & 1) != 0) return;
14382 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14383 CHECK_ACCESS(_res_ptr);
14384 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14386 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14389 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14390 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14391 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14392 return (uint64_t)ret_conv;
14394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14395 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
14396 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14401 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
14402 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14403 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14404 return (uint64_t)ret_conv;
14407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14408 LDKInMemorySigner o_conv;
14409 o_conv.inner = (void*)(o & (~1));
14410 o_conv.is_owned = (o & 1) || (o == 0);
14411 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14412 o_conv = InMemorySigner_clone(&o_conv);
14413 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14414 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
14415 return (uint64_t)ret_conv;
14418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14419 LDKDecodeError e_conv;
14420 e_conv.inner = (void*)(e & (~1));
14421 e_conv.is_owned = (e & 1) || (e == 0);
14422 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14423 e_conv = DecodeError_clone(&e_conv);
14424 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14425 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
14426 return (uint64_t)ret_conv;
14429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14430 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
14431 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
14435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14436 if ((_res & 1) != 0) return;
14437 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14438 CHECK_ACCESS(_res_ptr);
14439 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
14441 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
14444 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
14445 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14446 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
14447 return (uint64_t)ret_conv;
14449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14450 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
14451 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
14455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14456 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
14457 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14458 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
14459 return (uint64_t)ret_conv;
14462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14463 LDKCVec_TxOutZ _res_constr;
14464 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14465 if (_res_constr.datalen > 0)
14466 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14468 _res_constr.data = NULL;
14469 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14470 for (size_t h = 0; h < _res_constr.datalen; h++) {
14471 int64_t _res_conv_7 = _res_vals[h];
14472 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
14473 CHECK_ACCESS(_res_conv_7_ptr);
14474 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
14475 FREE((void*)_res_conv_7);
14476 _res_constr.data[h] = _res_conv_7_conv;
14478 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14479 CVec_TxOutZ_free(_res_constr);
14482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14483 LDKTransaction o_ref;
14484 o_ref.datalen = (*env)->GetArrayLength(env, o);
14485 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
14486 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
14487 o_ref.data_is_owned = true;
14488 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14489 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
14490 return (uint64_t)ret_conv;
14493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14494 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14495 *ret_conv = CResult_TransactionNoneZ_err();
14496 return (uint64_t)ret_conv;
14499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14500 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
14501 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
14505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14506 if ((_res & 1) != 0) return;
14507 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14508 CHECK_ACCESS(_res_ptr);
14509 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
14511 CResult_TransactionNoneZ_free(_res_conv);
14514 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
14515 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14516 *ret_conv = CResult_TransactionNoneZ_clone(arg);
14517 return (uint64_t)ret_conv;
14519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14520 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
14521 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
14525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14526 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
14527 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14528 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
14529 return (uint64_t)ret_conv;
14532 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
14533 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
14534 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
14535 return ((uint64_t)ret_conv);
14537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14538 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
14539 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
14543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14544 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
14545 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
14546 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
14547 return ((uint64_t)ret_conv);
14550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
14551 LDKThirtyTwoBytes a_ref;
14552 CHECK((*env)->GetArrayLength(env, a) == 32);
14553 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14554 LDKChannelMonitor b_conv;
14555 b_conv.inner = (void*)(b & (~1));
14556 b_conv.is_owned = (b & 1) || (b == 0);
14557 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14558 b_conv = ChannelMonitor_clone(&b_conv);
14559 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
14560 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
14561 return ((uint64_t)ret_conv);
14564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14565 if ((_res & 1) != 0) return;
14566 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14567 CHECK_ACCESS(_res_ptr);
14568 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
14570 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
14573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14574 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
14575 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14576 if (_res_constr.datalen > 0)
14577 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
14579 _res_constr.data = NULL;
14580 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14581 for (size_t j = 0; j < _res_constr.datalen; j++) {
14582 int64_t _res_conv_35 = _res_vals[j];
14583 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
14584 CHECK_ACCESS(_res_conv_35_ptr);
14585 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
14586 FREE((void*)_res_conv_35);
14587 _res_constr.data[j] = _res_conv_35_conv;
14589 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14590 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
14593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
14594 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
14595 o_constr.datalen = (*env)->GetArrayLength(env, o);
14596 if (o_constr.datalen > 0)
14597 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
14599 o_constr.data = NULL;
14600 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
14601 for (size_t j = 0; j < o_constr.datalen; j++) {
14602 int64_t o_conv_35 = o_vals[j];
14603 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
14604 CHECK_ACCESS(o_conv_35_ptr);
14605 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
14606 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
14607 o_constr.data[j] = o_conv_35_conv;
14609 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
14610 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
14611 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
14612 return (uint64_t)ret_conv;
14615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14616 LDKIOError e_conv = LDKIOError_from_java(env, e);
14617 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
14618 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
14619 return (uint64_t)ret_conv;
14622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14623 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
14624 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
14628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14629 if ((_res & 1) != 0) return;
14630 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14631 CHECK_ACCESS(_res_ptr);
14632 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
14634 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
14637 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
14638 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
14639 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
14640 return (uint64_t)ret_conv;
14642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14643 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
14644 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
14648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14649 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
14650 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
14651 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
14652 return (uint64_t)ret_conv;
14655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
14656 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14657 *ret_copy = COption_u16Z_some(o);
14658 uint64_t ret_ref = (uint64_t)ret_copy;
14662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
14663 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14664 *ret_copy = COption_u16Z_none();
14665 uint64_t ret_ref = (uint64_t)ret_copy;
14669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14670 if ((_res & 1) != 0) return;
14671 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14672 CHECK_ACCESS(_res_ptr);
14673 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
14675 COption_u16Z_free(_res_conv);
14678 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
14679 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14680 *ret_copy = COption_u16Z_clone(arg);
14681 uint64_t ret_ref = (uint64_t)ret_copy;
14684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14685 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
14686 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
14690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14691 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
14692 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14693 *ret_copy = COption_u16Z_clone(orig_conv);
14694 uint64_t ret_ref = (uint64_t)ret_copy;
14698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
14699 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14700 *ret_conv = CResult_NoneAPIErrorZ_ok();
14701 return (uint64_t)ret_conv;
14704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14705 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14706 CHECK_ACCESS(e_ptr);
14707 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14708 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
14709 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14710 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
14711 return (uint64_t)ret_conv;
14714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14715 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
14716 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
14720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14721 if ((_res & 1) != 0) return;
14722 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14723 CHECK_ACCESS(_res_ptr);
14724 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
14726 CResult_NoneAPIErrorZ_free(_res_conv);
14729 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
14730 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14731 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
14732 return (uint64_t)ret_conv;
14734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14735 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
14736 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
14740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14741 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
14742 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14743 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
14744 return (uint64_t)ret_conv;
14747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14748 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
14749 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14750 if (_res_constr.datalen > 0)
14751 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14753 _res_constr.data = NULL;
14754 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14755 for (size_t w = 0; w < _res_constr.datalen; w++) {
14756 int64_t _res_conv_22 = _res_vals[w];
14757 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
14758 CHECK_ACCESS(_res_conv_22_ptr);
14759 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
14760 FREE((void*)_res_conv_22);
14761 _res_constr.data[w] = _res_conv_22_conv;
14763 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14764 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
14767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14768 LDKCVec_APIErrorZ _res_constr;
14769 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14770 if (_res_constr.datalen > 0)
14771 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14773 _res_constr.data = NULL;
14774 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14775 for (size_t k = 0; k < _res_constr.datalen; k++) {
14776 int64_t _res_conv_10 = _res_vals[k];
14777 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
14778 CHECK_ACCESS(_res_conv_10_ptr);
14779 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
14780 FREE((void*)_res_conv_10);
14781 _res_constr.data[k] = _res_conv_10_conv;
14783 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14784 CVec_APIErrorZ_free(_res_constr);
14787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14788 LDKThirtyTwoBytes o_ref;
14789 CHECK((*env)->GetArrayLength(env, o) == 32);
14790 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
14791 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14792 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
14793 return (uint64_t)ret_conv;
14796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14797 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14798 CHECK_ACCESS(e_ptr);
14799 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14800 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
14801 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14802 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
14803 return (uint64_t)ret_conv;
14806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14807 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
14808 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
14812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14813 if ((_res & 1) != 0) return;
14814 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14815 CHECK_ACCESS(_res_ptr);
14816 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
14818 CResult__u832APIErrorZ_free(_res_conv);
14821 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
14822 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14823 *ret_conv = CResult__u832APIErrorZ_clone(arg);
14824 return (uint64_t)ret_conv;
14826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14827 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
14828 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
14832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14833 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
14834 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14835 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
14836 return (uint64_t)ret_conv;
14839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14840 LDKThirtyTwoBytes o_ref;
14841 CHECK((*env)->GetArrayLength(env, o) == 32);
14842 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
14843 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14844 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
14845 return (uint64_t)ret_conv;
14848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14849 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14850 CHECK_ACCESS(e_ptr);
14851 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14852 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
14853 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14854 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
14855 return (uint64_t)ret_conv;
14858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14859 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
14860 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
14864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14865 if ((_res & 1) != 0) return;
14866 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14867 CHECK_ACCESS(_res_ptr);
14868 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
14870 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
14873 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
14874 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14875 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
14876 return (uint64_t)ret_conv;
14878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14879 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
14880 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
14884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14885 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
14886 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14887 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
14888 return (uint64_t)ret_conv;
14891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
14892 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14893 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
14894 return (uint64_t)ret_conv;
14897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14898 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14899 CHECK_ACCESS(e_ptr);
14900 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14901 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
14902 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14903 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
14904 return (uint64_t)ret_conv;
14907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14908 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
14909 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
14913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14914 if ((_res & 1) != 0) return;
14915 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14916 CHECK_ACCESS(_res_ptr);
14917 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
14919 CResult_NonePaymentSendFailureZ_free(_res_conv);
14922 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
14923 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14924 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
14925 return (uint64_t)ret_conv;
14927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14928 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
14929 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
14933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14934 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
14935 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14936 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
14937 return (uint64_t)ret_conv;
14940 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
14941 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14942 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
14943 return ((uint64_t)ret_conv);
14945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14946 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
14947 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
14951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14952 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
14953 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14954 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
14955 return ((uint64_t)ret_conv);
14958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
14959 LDKThirtyTwoBytes a_ref;
14960 CHECK((*env)->GetArrayLength(env, a) == 32);
14961 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14962 LDKThirtyTwoBytes b_ref;
14963 CHECK((*env)->GetArrayLength(env, b) == 32);
14964 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
14965 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14966 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
14967 return ((uint64_t)ret_conv);
14970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14971 if ((_res & 1) != 0) return;
14972 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14973 CHECK_ACCESS(_res_ptr);
14974 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
14976 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
14979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14980 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14981 CHECK_ACCESS(o_ptr);
14982 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
14983 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
14984 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14985 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
14986 return (uint64_t)ret_conv;
14989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14990 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14991 CHECK_ACCESS(e_ptr);
14992 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14993 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
14994 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14995 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
14996 return (uint64_t)ret_conv;
14999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15000 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15001 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15006 if ((_res & 1) != 0) return;
15007 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15008 CHECK_ACCESS(_res_ptr);
15009 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15011 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15014 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15015 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15016 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15017 return (uint64_t)ret_conv;
15019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15020 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15021 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15026 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15027 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15028 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15029 return (uint64_t)ret_conv;
15032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15033 LDKCVec_NetAddressZ _res_constr;
15034 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15035 if (_res_constr.datalen > 0)
15036 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15038 _res_constr.data = NULL;
15039 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15040 for (size_t m = 0; m < _res_constr.datalen; m++) {
15041 int64_t _res_conv_12 = _res_vals[m];
15042 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
15043 CHECK_ACCESS(_res_conv_12_ptr);
15044 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15045 FREE((void*)_res_conv_12);
15046 _res_constr.data[m] = _res_conv_12_conv;
15048 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15049 CVec_NetAddressZ_free(_res_constr);
15052 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15053 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15054 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15055 return ((uint64_t)ret_conv);
15057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15058 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15059 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15064 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15065 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15066 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15067 return ((uint64_t)ret_conv);
15070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
15071 LDKThirtyTwoBytes a_ref;
15072 CHECK((*env)->GetArrayLength(env, a) == 32);
15073 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
15074 LDKThirtyTwoBytes b_ref;
15075 CHECK((*env)->GetArrayLength(env, b) == 32);
15076 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
15077 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15078 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15079 return ((uint64_t)ret_conv);
15082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15083 if ((_res & 1) != 0) return;
15084 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15085 CHECK_ACCESS(_res_ptr);
15086 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15088 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15092 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15093 CHECK_ACCESS(o_ptr);
15094 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15095 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15096 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15097 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15098 return (uint64_t)ret_conv;
15101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
15102 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15103 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15104 return (uint64_t)ret_conv;
15107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15108 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15109 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15114 if ((_res & 1) != 0) return;
15115 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15116 CHECK_ACCESS(_res_ptr);
15117 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15119 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15122 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15123 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15124 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15125 return (uint64_t)ret_conv;
15127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15128 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15129 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15134 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15135 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15136 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15137 return (uint64_t)ret_conv;
15140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15141 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15142 CHECK_ACCESS(o_ptr);
15143 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15144 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15145 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15146 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15147 return (uint64_t)ret_conv;
15150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15151 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15152 CHECK_ACCESS(e_ptr);
15153 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15154 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15155 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15156 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15157 return (uint64_t)ret_conv;
15160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15161 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15162 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15167 if ((_res & 1) != 0) return;
15168 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15169 CHECK_ACCESS(_res_ptr);
15170 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15172 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15175 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15176 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15177 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15178 return (uint64_t)ret_conv;
15180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15181 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15182 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15187 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15188 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15189 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15190 return (uint64_t)ret_conv;
15193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15194 LDKThirtyTwoBytes o_ref;
15195 CHECK((*env)->GetArrayLength(env, o) == 32);
15196 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
15197 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15198 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15199 return (uint64_t)ret_conv;
15202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
15203 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15204 *ret_conv = CResult_PaymentSecretNoneZ_err();
15205 return (uint64_t)ret_conv;
15208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15209 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15210 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15215 if ((_res & 1) != 0) return;
15216 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15217 CHECK_ACCESS(_res_ptr);
15218 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15220 CResult_PaymentSecretNoneZ_free(_res_conv);
15223 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15224 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15225 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15226 return (uint64_t)ret_conv;
15228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15229 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15230 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15235 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15236 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15237 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15238 return (uint64_t)ret_conv;
15241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15242 LDKThirtyTwoBytes o_ref;
15243 CHECK((*env)->GetArrayLength(env, o) == 32);
15244 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
15245 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15246 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15247 return (uint64_t)ret_conv;
15250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15251 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15252 CHECK_ACCESS(e_ptr);
15253 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15254 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15255 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15256 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15257 return (uint64_t)ret_conv;
15260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15261 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15262 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15267 if ((_res & 1) != 0) return;
15268 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15269 CHECK_ACCESS(_res_ptr);
15270 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15272 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15275 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15276 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15277 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15278 return (uint64_t)ret_conv;
15280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15281 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15282 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15287 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15288 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15289 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15290 return (uint64_t)ret_conv;
15293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15294 LDKThirtyTwoBytes o_ref;
15295 CHECK((*env)->GetArrayLength(env, o) == 32);
15296 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
15297 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15298 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15299 return (uint64_t)ret_conv;
15302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15303 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15304 CHECK_ACCESS(e_ptr);
15305 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15306 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15307 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15308 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15309 return (uint64_t)ret_conv;
15312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15313 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15314 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15319 if ((_res & 1) != 0) return;
15320 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15321 CHECK_ACCESS(_res_ptr);
15322 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15324 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15327 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15328 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15329 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15330 return (uint64_t)ret_conv;
15332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15333 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15334 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15339 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15340 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15341 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15342 return (uint64_t)ret_conv;
15345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15346 LDKCVec_ChannelMonitorZ _res_constr;
15347 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15348 if (_res_constr.datalen > 0)
15349 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15351 _res_constr.data = NULL;
15352 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15353 for (size_t q = 0; q < _res_constr.datalen; q++) {
15354 int64_t _res_conv_16 = _res_vals[q];
15355 LDKChannelMonitor _res_conv_16_conv;
15356 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15357 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15358 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15359 _res_constr.data[q] = _res_conv_16_conv;
15361 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15362 CVec_ChannelMonitorZ_free(_res_constr);
15365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
15366 LDKThirtyTwoBytes a_ref;
15367 CHECK((*env)->GetArrayLength(env, a) == 32);
15368 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
15369 LDKChannelManager b_conv;
15370 b_conv.inner = (void*)(b & (~1));
15371 b_conv.is_owned = (b & 1) || (b == 0);
15372 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15373 // Warning: we need a move here but no clone is available for LDKChannelManager
15374 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15375 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15376 return ((uint64_t)ret_conv);
15379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15380 if ((_res & 1) != 0) return;
15381 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15382 CHECK_ACCESS(_res_ptr);
15383 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15385 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
15388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15389 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15390 CHECK_ACCESS(o_ptr);
15391 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
15392 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
15393 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15394 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
15395 return (uint64_t)ret_conv;
15398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15399 LDKDecodeError e_conv;
15400 e_conv.inner = (void*)(e & (~1));
15401 e_conv.is_owned = (e & 1) || (e == 0);
15402 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15403 e_conv = DecodeError_clone(&e_conv);
15404 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15405 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
15406 return (uint64_t)ret_conv;
15409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15410 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
15411 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
15415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15416 if ((_res & 1) != 0) return;
15417 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15418 CHECK_ACCESS(_res_ptr);
15419 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
15421 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
15424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15425 LDKChannelConfig o_conv;
15426 o_conv.inner = (void*)(o & (~1));
15427 o_conv.is_owned = (o & 1) || (o == 0);
15428 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15429 o_conv = ChannelConfig_clone(&o_conv);
15430 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15431 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
15432 return (uint64_t)ret_conv;
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15436 LDKDecodeError e_conv;
15437 e_conv.inner = (void*)(e & (~1));
15438 e_conv.is_owned = (e & 1) || (e == 0);
15439 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15440 e_conv = DecodeError_clone(&e_conv);
15441 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15442 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
15443 return (uint64_t)ret_conv;
15446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15447 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
15448 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
15452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15453 if ((_res & 1) != 0) return;
15454 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15455 CHECK_ACCESS(_res_ptr);
15456 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
15458 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
15461 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
15462 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15463 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
15464 return (uint64_t)ret_conv;
15466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15467 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
15468 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
15472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15473 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
15474 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15475 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
15476 return (uint64_t)ret_conv;
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15480 LDKOutPoint o_conv;
15481 o_conv.inner = (void*)(o & (~1));
15482 o_conv.is_owned = (o & 1) || (o == 0);
15483 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15484 o_conv = OutPoint_clone(&o_conv);
15485 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15486 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
15487 return (uint64_t)ret_conv;
15490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15491 LDKDecodeError e_conv;
15492 e_conv.inner = (void*)(e & (~1));
15493 e_conv.is_owned = (e & 1) || (e == 0);
15494 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15495 e_conv = DecodeError_clone(&e_conv);
15496 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15497 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
15498 return (uint64_t)ret_conv;
15501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15502 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
15503 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
15507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15508 if ((_res & 1) != 0) return;
15509 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15510 CHECK_ACCESS(_res_ptr);
15511 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
15513 CResult_OutPointDecodeErrorZ_free(_res_conv);
15516 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
15517 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15518 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
15519 return (uint64_t)ret_conv;
15521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15522 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
15523 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
15527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15528 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
15529 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15530 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
15531 return (uint64_t)ret_conv;
15534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15535 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15536 CHECK_ACCESS(o_ptr);
15537 LDKType o_conv = *(LDKType*)(o_ptr);
15538 if (o_conv.free == LDKType_JCalls_free) {
15539 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15540 LDKType_JCalls_cloned(&o_conv);
15542 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15543 *ret_copy = COption_TypeZ_some(o_conv);
15544 uint64_t ret_ref = (uint64_t)ret_copy;
15548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
15549 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15550 *ret_copy = COption_TypeZ_none();
15551 uint64_t ret_ref = (uint64_t)ret_copy;
15555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15556 if ((_res & 1) != 0) return;
15557 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15558 CHECK_ACCESS(_res_ptr);
15559 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
15561 COption_TypeZ_free(_res_conv);
15564 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
15565 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15566 *ret_copy = COption_TypeZ_clone(arg);
15567 uint64_t ret_ref = (uint64_t)ret_copy;
15570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15571 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
15572 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
15576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15577 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
15578 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15579 *ret_copy = COption_TypeZ_clone(orig_conv);
15580 uint64_t ret_ref = (uint64_t)ret_copy;
15584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15585 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15586 CHECK_ACCESS(o_ptr);
15587 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
15588 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
15589 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15590 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
15591 return (uint64_t)ret_conv;
15594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15595 LDKDecodeError e_conv;
15596 e_conv.inner = (void*)(e & (~1));
15597 e_conv.is_owned = (e & 1) || (e == 0);
15598 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15599 e_conv = DecodeError_clone(&e_conv);
15600 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15601 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
15602 return (uint64_t)ret_conv;
15605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15606 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
15607 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
15611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15612 if ((_res & 1) != 0) return;
15613 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15614 CHECK_ACCESS(_res_ptr);
15615 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
15617 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
15620 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
15621 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15622 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
15623 return (uint64_t)ret_conv;
15625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15626 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
15627 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
15631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15632 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
15633 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15634 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
15635 return (uint64_t)ret_conv;
15638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15639 LDKThirtyTwoBytes o_ref;
15640 CHECK((*env)->GetArrayLength(env, o) == 32);
15641 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
15642 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15643 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
15644 return (uint64_t)ret_conv;
15647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15648 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15649 CHECK_ACCESS(e_ptr);
15650 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
15651 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
15652 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15653 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
15654 return (uint64_t)ret_conv;
15657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15658 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
15659 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
15663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15664 if ((_res & 1) != 0) return;
15665 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15666 CHECK_ACCESS(_res_ptr);
15667 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
15669 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
15672 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
15673 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15674 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
15675 return (uint64_t)ret_conv;
15677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15678 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
15679 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
15683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15684 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
15685 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15686 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
15687 return (uint64_t)ret_conv;
15690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
15691 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
15692 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15693 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
15694 return (uint64_t)ret_conv;
15697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
15698 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15699 *ret_conv = CResult_SiPrefixNoneZ_err();
15700 return (uint64_t)ret_conv;
15703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15704 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
15705 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
15709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15710 if ((_res & 1) != 0) return;
15711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15712 CHECK_ACCESS(_res_ptr);
15713 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
15715 CResult_SiPrefixNoneZ_free(_res_conv);
15718 static inline uint64_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
15719 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15720 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
15721 return (uint64_t)ret_conv;
15723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15724 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
15725 int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
15729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15730 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
15731 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15732 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
15733 return (uint64_t)ret_conv;
15736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15738 o_conv.inner = (void*)(o & (~1));
15739 o_conv.is_owned = (o & 1) || (o == 0);
15740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15741 o_conv = Invoice_clone(&o_conv);
15742 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15743 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
15744 return (uint64_t)ret_conv;
15747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
15748 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15749 *ret_conv = CResult_InvoiceNoneZ_err();
15750 return (uint64_t)ret_conv;
15753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15754 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
15755 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
15759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15760 if ((_res & 1) != 0) return;
15761 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15762 CHECK_ACCESS(_res_ptr);
15763 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
15765 CResult_InvoiceNoneZ_free(_res_conv);
15768 static inline uint64_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
15769 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15770 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
15771 return (uint64_t)ret_conv;
15773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15774 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
15775 int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
15779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15780 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
15781 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15782 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
15783 return (uint64_t)ret_conv;
15786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15787 LDKSignedRawInvoice o_conv;
15788 o_conv.inner = (void*)(o & (~1));
15789 o_conv.is_owned = (o & 1) || (o == 0);
15790 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15791 o_conv = SignedRawInvoice_clone(&o_conv);
15792 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15793 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
15794 return (uint64_t)ret_conv;
15797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
15798 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15799 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
15800 return (uint64_t)ret_conv;
15803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15804 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
15805 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
15809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15810 if ((_res & 1) != 0) return;
15811 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15812 CHECK_ACCESS(_res_ptr);
15813 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
15815 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
15818 static inline uint64_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
15819 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15820 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
15821 return (uint64_t)ret_conv;
15823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15824 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
15825 int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
15829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15830 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
15831 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15832 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
15833 return (uint64_t)ret_conv;
15836 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
15837 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15838 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
15839 return ((uint64_t)ret_conv);
15841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15842 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
15843 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
15847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15848 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
15849 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15850 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
15851 return ((uint64_t)ret_conv);
15854 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) {
15855 LDKRawInvoice a_conv;
15856 a_conv.inner = (void*)(a & (~1));
15857 a_conv.is_owned = (a & 1) || (a == 0);
15858 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15859 a_conv = RawInvoice_clone(&a_conv);
15860 LDKThirtyTwoBytes b_ref;
15861 CHECK((*env)->GetArrayLength(env, b) == 32);
15862 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
15863 LDKInvoiceSignature c_conv;
15864 c_conv.inner = (void*)(c & (~1));
15865 c_conv.is_owned = (c & 1) || (c == 0);
15866 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15867 c_conv = InvoiceSignature_clone(&c_conv);
15868 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15869 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
15870 return ((uint64_t)ret_conv);
15873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15874 if ((_res & 1) != 0) return;
15875 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15876 CHECK_ACCESS(_res_ptr);
15877 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
15879 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
15882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15883 LDKPayeePubKey o_conv;
15884 o_conv.inner = (void*)(o & (~1));
15885 o_conv.is_owned = (o & 1) || (o == 0);
15886 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15887 o_conv = PayeePubKey_clone(&o_conv);
15888 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15889 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
15890 return (uint64_t)ret_conv;
15893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15894 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15895 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15896 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
15897 return (uint64_t)ret_conv;
15900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15901 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
15902 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
15906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15907 if ((_res & 1) != 0) return;
15908 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15909 CHECK_ACCESS(_res_ptr);
15910 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
15912 CResult_PayeePubKeyErrorZ_free(_res_conv);
15915 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
15916 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15917 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
15918 return (uint64_t)ret_conv;
15920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15921 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
15922 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
15926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15927 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
15928 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15929 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
15930 return (uint64_t)ret_conv;
15933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15934 LDKCVec_PrivateRouteZ _res_constr;
15935 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15936 if (_res_constr.datalen > 0)
15937 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
15939 _res_constr.data = NULL;
15940 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15941 for (size_t o = 0; o < _res_constr.datalen; o++) {
15942 int64_t _res_conv_14 = _res_vals[o];
15943 LDKPrivateRoute _res_conv_14_conv;
15944 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15945 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15946 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15947 _res_constr.data[o] = _res_conv_14_conv;
15949 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15950 CVec_PrivateRouteZ_free(_res_constr);
15953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15954 LDKPositiveTimestamp o_conv;
15955 o_conv.inner = (void*)(o & (~1));
15956 o_conv.is_owned = (o & 1) || (o == 0);
15957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15958 o_conv = PositiveTimestamp_clone(&o_conv);
15959 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15960 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
15961 return (uint64_t)ret_conv;
15964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15965 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
15966 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15967 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
15968 return (uint64_t)ret_conv;
15971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15972 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
15973 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
15977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15978 if ((_res & 1) != 0) return;
15979 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15980 CHECK_ACCESS(_res_ptr);
15981 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
15983 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
15986 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
15987 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15988 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
15989 return (uint64_t)ret_conv;
15991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15992 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
15993 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
15997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15998 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
15999 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16000 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16001 return (uint64_t)ret_conv;
16004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
16005 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16006 *ret_conv = CResult_NoneSemanticErrorZ_ok();
16007 return (uint64_t)ret_conv;
16010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16011 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
16012 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16013 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16014 return (uint64_t)ret_conv;
16017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16018 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
16019 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16024 if ((_res & 1) != 0) return;
16025 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16026 CHECK_ACCESS(_res_ptr);
16027 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16029 CResult_NoneSemanticErrorZ_free(_res_conv);
16032 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16033 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16034 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16035 return (uint64_t)ret_conv;
16037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16038 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
16039 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16044 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
16045 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16046 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16047 return (uint64_t)ret_conv;
16050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16052 o_conv.inner = (void*)(o & (~1));
16053 o_conv.is_owned = (o & 1) || (o == 0);
16054 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16055 o_conv = Invoice_clone(&o_conv);
16056 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16057 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16058 return (uint64_t)ret_conv;
16061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16062 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
16063 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16064 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16065 return (uint64_t)ret_conv;
16068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16069 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
16070 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16075 if ((_res & 1) != 0) return;
16076 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16077 CHECK_ACCESS(_res_ptr);
16078 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16080 CResult_InvoiceSemanticErrorZ_free(_res_conv);
16083 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16084 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16085 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16086 return (uint64_t)ret_conv;
16088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16089 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
16090 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16095 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
16096 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16097 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16098 return (uint64_t)ret_conv;
16101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16102 LDKDescription o_conv;
16103 o_conv.inner = (void*)(o & (~1));
16104 o_conv.is_owned = (o & 1) || (o == 0);
16105 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16106 o_conv = Description_clone(&o_conv);
16107 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16108 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16109 return (uint64_t)ret_conv;
16112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16113 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
16114 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16115 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16116 return (uint64_t)ret_conv;
16119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16120 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
16121 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16126 if ((_res & 1) != 0) return;
16127 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16128 CHECK_ACCESS(_res_ptr);
16129 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16131 CResult_DescriptionCreationErrorZ_free(_res_conv);
16134 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16135 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16136 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16137 return (uint64_t)ret_conv;
16139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16140 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
16141 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16146 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
16147 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16148 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16149 return (uint64_t)ret_conv;
16152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16153 LDKExpiryTime o_conv;
16154 o_conv.inner = (void*)(o & (~1));
16155 o_conv.is_owned = (o & 1) || (o == 0);
16156 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16157 o_conv = ExpiryTime_clone(&o_conv);
16158 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
16159 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
16160 return (uint64_t)ret_conv;
16163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16164 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
16165 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
16166 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
16167 return (uint64_t)ret_conv;
16170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16171 LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1);
16172 jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv);
16176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16177 if ((_res & 1) != 0) return;
16178 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16179 CHECK_ACCESS(_res_ptr);
16180 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
16182 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
16185 static inline uint64_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) {
16186 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
16187 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg);
16188 return (uint64_t)ret_conv;
16190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16191 LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
16192 int64_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv);
16196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16197 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
16198 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
16199 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
16200 return (uint64_t)ret_conv;
16203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16204 LDKPrivateRoute o_conv;
16205 o_conv.inner = (void*)(o & (~1));
16206 o_conv.is_owned = (o & 1) || (o == 0);
16207 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16208 o_conv = PrivateRoute_clone(&o_conv);
16209 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16210 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16211 return (uint64_t)ret_conv;
16214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16215 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
16216 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16217 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16218 return (uint64_t)ret_conv;
16221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16222 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
16223 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16228 if ((_res & 1) != 0) return;
16229 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16230 CHECK_ACCESS(_res_ptr);
16231 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16233 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16236 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16237 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16238 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16239 return (uint64_t)ret_conv;
16241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16242 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
16243 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16248 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
16249 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16250 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16251 return (uint64_t)ret_conv;
16254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
16255 LDKStr o_conv = java_to_owned_str(env, o);
16256 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16257 *ret_conv = CResult_StringErrorZ_ok(o_conv);
16258 return (uint64_t)ret_conv;
16261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16262 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
16263 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16264 *ret_conv = CResult_StringErrorZ_err(e_conv);
16265 return (uint64_t)ret_conv;
16268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16269 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
16270 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
16274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16275 if ((_res & 1) != 0) return;
16276 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16277 CHECK_ACCESS(_res_ptr);
16278 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16280 CResult_StringErrorZ_free(_res_conv);
16283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16284 LDKChannelMonitorUpdate o_conv;
16285 o_conv.inner = (void*)(o & (~1));
16286 o_conv.is_owned = (o & 1) || (o == 0);
16287 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16288 o_conv = ChannelMonitorUpdate_clone(&o_conv);
16289 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16290 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16291 return (uint64_t)ret_conv;
16294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16295 LDKDecodeError e_conv;
16296 e_conv.inner = (void*)(e & (~1));
16297 e_conv.is_owned = (e & 1) || (e == 0);
16298 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16299 e_conv = DecodeError_clone(&e_conv);
16300 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16301 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16302 return (uint64_t)ret_conv;
16305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16306 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
16307 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16312 if ((_res & 1) != 0) return;
16313 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16314 CHECK_ACCESS(_res_ptr);
16315 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16317 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16320 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16321 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16322 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16323 return (uint64_t)ret_conv;
16325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16326 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
16327 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16332 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
16333 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16334 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16335 return (uint64_t)ret_conv;
16338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16339 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16340 CHECK_ACCESS(o_ptr);
16341 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16342 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
16343 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16344 *ret_copy = COption_MonitorEventZ_some(o_conv);
16345 uint64_t ret_ref = (uint64_t)ret_copy;
16349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
16350 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16351 *ret_copy = COption_MonitorEventZ_none();
16352 uint64_t ret_ref = (uint64_t)ret_copy;
16356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16357 if ((_res & 1) != 0) return;
16358 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16359 CHECK_ACCESS(_res_ptr);
16360 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
16362 COption_MonitorEventZ_free(_res_conv);
16365 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
16366 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16367 *ret_copy = COption_MonitorEventZ_clone(arg);
16368 uint64_t ret_ref = (uint64_t)ret_copy;
16371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16372 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
16373 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
16377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16378 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
16379 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16380 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
16381 uint64_t ret_ref = (uint64_t)ret_copy;
16385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16386 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16387 CHECK_ACCESS(o_ptr);
16388 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
16389 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
16390 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16391 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
16392 return (uint64_t)ret_conv;
16395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16396 LDKDecodeError e_conv;
16397 e_conv.inner = (void*)(e & (~1));
16398 e_conv.is_owned = (e & 1) || (e == 0);
16399 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16400 e_conv = DecodeError_clone(&e_conv);
16401 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16402 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
16403 return (uint64_t)ret_conv;
16406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16407 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
16408 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
16412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16413 if ((_res & 1) != 0) return;
16414 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16415 CHECK_ACCESS(_res_ptr);
16416 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
16418 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
16421 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
16422 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16423 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
16424 return (uint64_t)ret_conv;
16426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16427 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
16428 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
16432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16433 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
16434 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16435 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
16436 return (uint64_t)ret_conv;
16439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16440 LDKHTLCUpdate o_conv;
16441 o_conv.inner = (void*)(o & (~1));
16442 o_conv.is_owned = (o & 1) || (o == 0);
16443 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16444 o_conv = HTLCUpdate_clone(&o_conv);
16445 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16446 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
16447 return (uint64_t)ret_conv;
16450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16451 LDKDecodeError e_conv;
16452 e_conv.inner = (void*)(e & (~1));
16453 e_conv.is_owned = (e & 1) || (e == 0);
16454 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16455 e_conv = DecodeError_clone(&e_conv);
16456 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16457 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
16458 return (uint64_t)ret_conv;
16461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16462 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
16463 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
16467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16468 if ((_res & 1) != 0) return;
16469 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16470 CHECK_ACCESS(_res_ptr);
16471 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
16473 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
16476 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
16477 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16478 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
16479 return (uint64_t)ret_conv;
16481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16482 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
16483 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
16487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16488 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
16489 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16490 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
16491 return (uint64_t)ret_conv;
16494 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
16495 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16496 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
16497 return ((uint64_t)ret_conv);
16499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16500 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
16501 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
16505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16506 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
16507 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16508 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
16509 return ((uint64_t)ret_conv);
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
16513 LDKOutPoint a_conv;
16514 a_conv.inner = (void*)(a & (~1));
16515 a_conv.is_owned = (a & 1) || (a == 0);
16516 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16517 a_conv = OutPoint_clone(&a_conv);
16519 b_ref.datalen = (*env)->GetArrayLength(env, b);
16520 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16521 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
16522 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16523 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
16524 return ((uint64_t)ret_conv);
16527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16528 if ((_res & 1) != 0) return;
16529 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16530 CHECK_ACCESS(_res_ptr);
16531 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
16533 C2Tuple_OutPointScriptZ_free(_res_conv);
16536 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
16537 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16538 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
16539 return ((uint64_t)ret_conv);
16541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16542 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
16543 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
16547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16548 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
16549 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16550 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
16551 return ((uint64_t)ret_conv);
16554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
16556 b_ref.datalen = (*env)->GetArrayLength(env, b);
16557 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16558 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
16559 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16560 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
16561 return ((uint64_t)ret_conv);
16564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16565 if ((_res & 1) != 0) return;
16566 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16567 CHECK_ACCESS(_res_ptr);
16568 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
16570 C2Tuple_u32ScriptZ_free(_res_conv);
16573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16574 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
16575 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16576 if (_res_constr.datalen > 0)
16577 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16579 _res_constr.data = NULL;
16580 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16581 for (size_t v = 0; v < _res_constr.datalen; v++) {
16582 int64_t _res_conv_21 = _res_vals[v];
16583 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
16584 CHECK_ACCESS(_res_conv_21_ptr);
16585 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
16586 FREE((void*)_res_conv_21);
16587 _res_constr.data[v] = _res_conv_21_conv;
16589 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16590 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
16593 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
16594 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16595 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
16596 return ((uint64_t)ret_conv);
16598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16599 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
16600 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
16604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16605 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
16606 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16607 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
16608 return ((uint64_t)ret_conv);
16611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
16612 LDKThirtyTwoBytes a_ref;
16613 CHECK((*env)->GetArrayLength(env, a) == 32);
16614 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16615 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
16616 b_constr.datalen = (*env)->GetArrayLength(env, b);
16617 if (b_constr.datalen > 0)
16618 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16620 b_constr.data = NULL;
16621 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16622 for (size_t v = 0; v < b_constr.datalen; v++) {
16623 int64_t b_conv_21 = b_vals[v];
16624 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
16625 CHECK_ACCESS(b_conv_21_ptr);
16626 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
16627 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
16628 b_constr.data[v] = b_conv_21_conv;
16630 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16631 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16632 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
16633 return ((uint64_t)ret_conv);
16636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16637 if ((_res & 1) != 0) return;
16638 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16639 CHECK_ACCESS(_res_ptr);
16640 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
16642 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16646 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
16647 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16648 if (_res_constr.datalen > 0)
16649 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
16651 _res_constr.data = NULL;
16652 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16653 for (size_t o = 0; o < _res_constr.datalen; o++) {
16654 int64_t _res_conv_40 = _res_vals[o];
16655 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
16656 CHECK_ACCESS(_res_conv_40_ptr);
16657 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
16658 FREE((void*)_res_conv_40);
16659 _res_constr.data[o] = _res_conv_40_conv;
16661 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16662 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
16665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16666 LDKCVec_EventZ _res_constr;
16667 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16668 if (_res_constr.datalen > 0)
16669 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
16671 _res_constr.data = NULL;
16672 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16673 for (size_t h = 0; h < _res_constr.datalen; h++) {
16674 int64_t _res_conv_7 = _res_vals[h];
16675 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
16676 CHECK_ACCESS(_res_conv_7_ptr);
16677 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
16678 FREE((void*)_res_conv_7);
16679 _res_constr.data[h] = _res_conv_7_conv;
16681 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16682 CVec_EventZ_free(_res_constr);
16685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16686 LDKCVec_TransactionZ _res_constr;
16687 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16688 if (_res_constr.datalen > 0)
16689 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
16691 _res_constr.data = NULL;
16692 for (size_t i = 0; i < _res_constr.datalen; i++) {
16693 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16694 LDKTransaction _res_conv_8_ref;
16695 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
16696 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
16697 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
16698 _res_conv_8_ref.data_is_owned = true;
16699 _res_constr.data[i] = _res_conv_8_ref;
16701 CVec_TransactionZ_free(_res_constr);
16704 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
16705 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16706 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
16707 return ((uint64_t)ret_conv);
16709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16710 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
16711 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
16715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16716 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
16717 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16718 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
16719 return ((uint64_t)ret_conv);
16722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
16723 void* b_ptr = (void*)(((uint64_t)b) & ~1);
16724 CHECK_ACCESS(b_ptr);
16725 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
16726 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
16727 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16728 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
16729 return ((uint64_t)ret_conv);
16732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16733 if ((_res & 1) != 0) return;
16734 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16735 CHECK_ACCESS(_res_ptr);
16736 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
16738 C2Tuple_u32TxOutZ_free(_res_conv);
16741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16742 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
16743 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16744 if (_res_constr.datalen > 0)
16745 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16747 _res_constr.data = NULL;
16748 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16749 for (size_t u = 0; u < _res_constr.datalen; u++) {
16750 int64_t _res_conv_20 = _res_vals[u];
16751 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
16752 CHECK_ACCESS(_res_conv_20_ptr);
16753 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
16754 FREE((void*)_res_conv_20);
16755 _res_constr.data[u] = _res_conv_20_conv;
16757 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16758 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
16761 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
16762 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16763 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
16764 return ((uint64_t)ret_conv);
16766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16767 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
16768 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
16772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16773 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
16774 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16775 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
16776 return ((uint64_t)ret_conv);
16779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
16780 LDKThirtyTwoBytes a_ref;
16781 CHECK((*env)->GetArrayLength(env, a) == 32);
16782 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16783 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
16784 b_constr.datalen = (*env)->GetArrayLength(env, b);
16785 if (b_constr.datalen > 0)
16786 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16788 b_constr.data = NULL;
16789 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16790 for (size_t u = 0; u < b_constr.datalen; u++) {
16791 int64_t b_conv_20 = b_vals[u];
16792 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
16793 CHECK_ACCESS(b_conv_20_ptr);
16794 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
16795 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
16796 b_constr.data[u] = b_conv_20_conv;
16798 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16799 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16800 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
16801 return ((uint64_t)ret_conv);
16804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16805 if ((_res & 1) != 0) return;
16806 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16807 CHECK_ACCESS(_res_ptr);
16808 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
16810 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
16813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16814 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
16815 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16816 if (_res_constr.datalen > 0)
16817 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
16819 _res_constr.data = NULL;
16820 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16821 for (size_t n = 0; n < _res_constr.datalen; n++) {
16822 int64_t _res_conv_39 = _res_vals[n];
16823 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
16824 CHECK_ACCESS(_res_conv_39_ptr);
16825 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
16826 FREE((void*)_res_conv_39);
16827 _res_constr.data[n] = _res_conv_39_conv;
16829 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16830 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
16833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16834 LDKCVec_BalanceZ _res_constr;
16835 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16836 if (_res_constr.datalen > 0)
16837 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
16839 _res_constr.data = NULL;
16840 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16841 for (size_t j = 0; j < _res_constr.datalen; j++) {
16842 int64_t _res_conv_9 = _res_vals[j];
16843 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
16844 CHECK_ACCESS(_res_conv_9_ptr);
16845 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
16846 FREE((void*)_res_conv_9);
16847 _res_constr.data[j] = _res_conv_9_conv;
16849 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16850 CVec_BalanceZ_free(_res_constr);
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16854 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16855 CHECK_ACCESS(o_ptr);
16856 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
16857 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
16858 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16859 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
16860 return (uint64_t)ret_conv;
16863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16864 LDKDecodeError e_conv;
16865 e_conv.inner = (void*)(e & (~1));
16866 e_conv.is_owned = (e & 1) || (e == 0);
16867 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16868 e_conv = DecodeError_clone(&e_conv);
16869 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16870 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
16871 return (uint64_t)ret_conv;
16874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16875 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
16876 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
16880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16881 if ((_res & 1) != 0) return;
16882 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16883 CHECK_ACCESS(_res_ptr);
16884 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
16886 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
16889 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
16890 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16891 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
16892 return (uint64_t)ret_conv;
16894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16895 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
16896 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
16900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16901 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
16902 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16903 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
16904 return (uint64_t)ret_conv;
16907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
16908 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16909 *ret_conv = CResult_NoneLightningErrorZ_ok();
16910 return (uint64_t)ret_conv;
16913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16914 LDKLightningError e_conv;
16915 e_conv.inner = (void*)(e & (~1));
16916 e_conv.is_owned = (e & 1) || (e == 0);
16917 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16918 e_conv = LightningError_clone(&e_conv);
16919 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16920 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16921 return (uint64_t)ret_conv;
16924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16925 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
16926 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
16930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16931 if ((_res & 1) != 0) return;
16932 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16933 CHECK_ACCESS(_res_ptr);
16934 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16936 CResult_NoneLightningErrorZ_free(_res_conv);
16939 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16940 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16941 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16942 return (uint64_t)ret_conv;
16944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16945 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
16946 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16951 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
16952 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16953 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16954 return (uint64_t)ret_conv;
16957 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
16958 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16959 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
16960 return ((uint64_t)ret_conv);
16962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16963 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
16964 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
16968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16969 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
16970 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16971 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
16972 return ((uint64_t)ret_conv);
16975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
16976 LDKPublicKey a_ref;
16977 CHECK((*env)->GetArrayLength(env, a) == 33);
16978 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
16979 void* b_ptr = (void*)(((uint64_t)b) & ~1);
16980 CHECK_ACCESS(b_ptr);
16981 LDKType b_conv = *(LDKType*)(b_ptr);
16982 if (b_conv.free == LDKType_JCalls_free) {
16983 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16984 LDKType_JCalls_cloned(&b_conv);
16986 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16987 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
16988 return ((uint64_t)ret_conv);
16991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16992 if ((_res & 1) != 0) return;
16993 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16994 CHECK_ACCESS(_res_ptr);
16995 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
16997 C2Tuple_PublicKeyTypeZ_free(_res_conv);
17000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17001 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17002 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17003 if (_res_constr.datalen > 0)
17004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17006 _res_constr.data = NULL;
17007 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17008 for (size_t z = 0; z < _res_constr.datalen; z++) {
17009 int64_t _res_conv_25 = _res_vals[z];
17010 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
17011 CHECK_ACCESS(_res_conv_25_ptr);
17012 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17013 FREE((void*)_res_conv_25);
17014 _res_constr.data[z] = _res_conv_25_conv;
17016 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17017 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17021 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17022 *ret_conv = CResult_boolLightningErrorZ_ok(o);
17023 return (uint64_t)ret_conv;
17026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17027 LDKLightningError e_conv;
17028 e_conv.inner = (void*)(e & (~1));
17029 e_conv.is_owned = (e & 1) || (e == 0);
17030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17031 e_conv = LightningError_clone(&e_conv);
17032 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17033 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
17034 return (uint64_t)ret_conv;
17037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17038 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
17039 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
17043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17044 if ((_res & 1) != 0) return;
17045 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17046 CHECK_ACCESS(_res_ptr);
17047 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
17049 CResult_boolLightningErrorZ_free(_res_conv);
17052 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
17053 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17054 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
17055 return (uint64_t)ret_conv;
17057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17058 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
17059 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
17063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17064 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
17065 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17066 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
17067 return (uint64_t)ret_conv;
17070 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
17071 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17072 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
17073 return ((uint64_t)ret_conv);
17075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17076 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
17077 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
17081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17082 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
17083 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17084 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
17085 return ((uint64_t)ret_conv);
17088 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) {
17089 LDKChannelAnnouncement a_conv;
17090 a_conv.inner = (void*)(a & (~1));
17091 a_conv.is_owned = (a & 1) || (a == 0);
17092 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17093 a_conv = ChannelAnnouncement_clone(&a_conv);
17094 LDKChannelUpdate b_conv;
17095 b_conv.inner = (void*)(b & (~1));
17096 b_conv.is_owned = (b & 1) || (b == 0);
17097 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17098 b_conv = ChannelUpdate_clone(&b_conv);
17099 LDKChannelUpdate c_conv;
17100 c_conv.inner = (void*)(c & (~1));
17101 c_conv.is_owned = (c & 1) || (c == 0);
17102 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17103 c_conv = ChannelUpdate_clone(&c_conv);
17104 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17105 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
17106 return ((uint64_t)ret_conv);
17109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17110 if ((_res & 1) != 0) return;
17111 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17112 CHECK_ACCESS(_res_ptr);
17113 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
17115 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
17118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17119 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
17120 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17121 if (_res_constr.datalen > 0)
17122 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
17124 _res_constr.data = NULL;
17125 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17126 for (size_t h = 0; h < _res_constr.datalen; h++) {
17127 int64_t _res_conv_59 = _res_vals[h];
17128 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
17129 CHECK_ACCESS(_res_conv_59_ptr);
17130 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
17131 FREE((void*)_res_conv_59);
17132 _res_constr.data[h] = _res_conv_59_conv;
17134 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17135 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
17138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17139 LDKCVec_NodeAnnouncementZ _res_constr;
17140 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17141 if (_res_constr.datalen > 0)
17142 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
17144 _res_constr.data = NULL;
17145 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17146 for (size_t s = 0; s < _res_constr.datalen; s++) {
17147 int64_t _res_conv_18 = _res_vals[s];
17148 LDKNodeAnnouncement _res_conv_18_conv;
17149 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
17150 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
17151 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
17152 _res_constr.data[s] = _res_conv_18_conv;
17154 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17155 CVec_NodeAnnouncementZ_free(_res_constr);
17158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17159 LDKCVec_PublicKeyZ _res_constr;
17160 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17161 if (_res_constr.datalen > 0)
17162 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
17164 _res_constr.data = NULL;
17165 for (size_t i = 0; i < _res_constr.datalen; i++) {
17166 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17167 LDKPublicKey _res_conv_8_ref;
17168 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
17169 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
17170 _res_constr.data[i] = _res_conv_8_ref;
17172 CVec_PublicKeyZ_free(_res_constr);
17175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17177 o_ref.datalen = (*env)->GetArrayLength(env, o);
17178 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17179 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
17180 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17181 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17182 return (uint64_t)ret_conv;
17185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17186 LDKPeerHandleError e_conv;
17187 e_conv.inner = (void*)(e & (~1));
17188 e_conv.is_owned = (e & 1) || (e == 0);
17189 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17190 e_conv = PeerHandleError_clone(&e_conv);
17191 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17192 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17193 return (uint64_t)ret_conv;
17196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17197 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
17198 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17203 if ((_res & 1) != 0) return;
17204 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17205 CHECK_ACCESS(_res_ptr);
17206 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17208 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17211 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17212 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17213 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17214 return (uint64_t)ret_conv;
17216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17217 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
17218 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17223 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
17224 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17225 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17226 return (uint64_t)ret_conv;
17229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
17230 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17231 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17232 return (uint64_t)ret_conv;
17235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17236 LDKPeerHandleError e_conv;
17237 e_conv.inner = (void*)(e & (~1));
17238 e_conv.is_owned = (e & 1) || (e == 0);
17239 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17240 e_conv = PeerHandleError_clone(&e_conv);
17241 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17242 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17243 return (uint64_t)ret_conv;
17246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17247 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
17248 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17253 if ((_res & 1) != 0) return;
17254 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17255 CHECK_ACCESS(_res_ptr);
17256 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17258 CResult_NonePeerHandleErrorZ_free(_res_conv);
17261 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17262 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17263 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17264 return (uint64_t)ret_conv;
17266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17267 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
17268 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17273 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
17274 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17275 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17276 return (uint64_t)ret_conv;
17279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17280 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17281 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17282 return (uint64_t)ret_conv;
17285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17286 LDKPeerHandleError e_conv;
17287 e_conv.inner = (void*)(e & (~1));
17288 e_conv.is_owned = (e & 1) || (e == 0);
17289 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17290 e_conv = PeerHandleError_clone(&e_conv);
17291 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17292 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17293 return (uint64_t)ret_conv;
17296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17297 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
17298 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17303 if ((_res & 1) != 0) return;
17304 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17305 CHECK_ACCESS(_res_ptr);
17306 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17308 CResult_boolPeerHandleErrorZ_free(_res_conv);
17311 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17312 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17313 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17314 return (uint64_t)ret_conv;
17316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17317 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
17318 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17323 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
17324 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17325 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17326 return (uint64_t)ret_conv;
17329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17331 o_conv.inner = (void*)(o & (~1));
17332 o_conv.is_owned = (o & 1) || (o == 0);
17333 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17334 o_conv = NodeId_clone(&o_conv);
17335 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17336 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
17337 return (uint64_t)ret_conv;
17340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17341 LDKDecodeError e_conv;
17342 e_conv.inner = (void*)(e & (~1));
17343 e_conv.is_owned = (e & 1) || (e == 0);
17344 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17345 e_conv = DecodeError_clone(&e_conv);
17346 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17347 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
17348 return (uint64_t)ret_conv;
17351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17352 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
17353 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
17357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17358 if ((_res & 1) != 0) return;
17359 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17360 CHECK_ACCESS(_res_ptr);
17361 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
17363 CResult_NodeIdDecodeErrorZ_free(_res_conv);
17366 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
17367 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17368 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
17369 return (uint64_t)ret_conv;
17371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17372 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
17373 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
17377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17378 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
17379 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17380 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
17381 return (uint64_t)ret_conv;
17384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17385 void* o_ptr = (void*)(((uint64_t)o) & ~1);
17386 CHECK_ACCESS(o_ptr);
17387 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
17388 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
17389 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17390 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
17391 return (uint64_t)ret_conv;
17394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17395 LDKDecodeError e_conv;
17396 e_conv.inner = (void*)(e & (~1));
17397 e_conv.is_owned = (e & 1) || (e == 0);
17398 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17399 e_conv = DecodeError_clone(&e_conv);
17400 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17401 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
17402 return (uint64_t)ret_conv;
17405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17406 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
17407 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
17411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17412 if ((_res & 1) != 0) return;
17413 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17414 CHECK_ACCESS(_res_ptr);
17415 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
17417 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
17420 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
17421 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17422 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
17423 return (uint64_t)ret_conv;
17425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17426 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
17427 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
17431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17432 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
17433 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17434 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
17435 return (uint64_t)ret_conv;
17438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17439 void* o_ptr = (void*)(((uint64_t)o) & ~1);
17440 CHECK_ACCESS(o_ptr);
17441 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
17442 if (o_conv.free == LDKAccess_JCalls_free) {
17443 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17444 LDKAccess_JCalls_cloned(&o_conv);
17446 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17447 *ret_copy = COption_AccessZ_some(o_conv);
17448 uint64_t ret_ref = (uint64_t)ret_copy;
17452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
17453 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17454 *ret_copy = COption_AccessZ_none();
17455 uint64_t ret_ref = (uint64_t)ret_copy;
17459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17460 if ((_res & 1) != 0) return;
17461 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17462 CHECK_ACCESS(_res_ptr);
17463 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
17465 COption_AccessZ_free(_res_conv);
17468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17469 LDKDirectionalChannelInfo o_conv;
17470 o_conv.inner = (void*)(o & (~1));
17471 o_conv.is_owned = (o & 1) || (o == 0);
17472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17473 o_conv = DirectionalChannelInfo_clone(&o_conv);
17474 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17475 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
17476 return (uint64_t)ret_conv;
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17480 LDKDecodeError e_conv;
17481 e_conv.inner = (void*)(e & (~1));
17482 e_conv.is_owned = (e & 1) || (e == 0);
17483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17484 e_conv = DecodeError_clone(&e_conv);
17485 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17486 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
17487 return (uint64_t)ret_conv;
17490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17491 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
17492 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
17496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17497 if ((_res & 1) != 0) return;
17498 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17499 CHECK_ACCESS(_res_ptr);
17500 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
17502 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
17505 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17506 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17507 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
17508 return (uint64_t)ret_conv;
17510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17511 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
17512 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17517 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
17518 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17519 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
17520 return (uint64_t)ret_conv;
17523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17524 LDKChannelInfo o_conv;
17525 o_conv.inner = (void*)(o & (~1));
17526 o_conv.is_owned = (o & 1) || (o == 0);
17527 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17528 o_conv = ChannelInfo_clone(&o_conv);
17529 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17530 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
17531 return (uint64_t)ret_conv;
17534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17535 LDKDecodeError e_conv;
17536 e_conv.inner = (void*)(e & (~1));
17537 e_conv.is_owned = (e & 1) || (e == 0);
17538 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17539 e_conv = DecodeError_clone(&e_conv);
17540 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17541 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
17542 return (uint64_t)ret_conv;
17545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17546 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
17547 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
17551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17552 if ((_res & 1) != 0) return;
17553 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17554 CHECK_ACCESS(_res_ptr);
17555 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
17557 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
17560 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17561 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17562 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
17563 return (uint64_t)ret_conv;
17565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17566 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
17567 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17572 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
17573 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17574 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
17575 return (uint64_t)ret_conv;
17578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17579 LDKRoutingFees o_conv;
17580 o_conv.inner = (void*)(o & (~1));
17581 o_conv.is_owned = (o & 1) || (o == 0);
17582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17583 o_conv = RoutingFees_clone(&o_conv);
17584 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17585 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
17586 return (uint64_t)ret_conv;
17589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17590 LDKDecodeError e_conv;
17591 e_conv.inner = (void*)(e & (~1));
17592 e_conv.is_owned = (e & 1) || (e == 0);
17593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17594 e_conv = DecodeError_clone(&e_conv);
17595 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17596 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
17597 return (uint64_t)ret_conv;
17600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17601 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
17602 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
17606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17607 if ((_res & 1) != 0) return;
17608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17609 CHECK_ACCESS(_res_ptr);
17610 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
17612 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
17615 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
17616 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17617 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
17618 return (uint64_t)ret_conv;
17620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17621 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
17622 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
17626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17627 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
17628 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17629 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
17630 return (uint64_t)ret_conv;
17633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17634 LDKNodeAnnouncementInfo o_conv;
17635 o_conv.inner = (void*)(o & (~1));
17636 o_conv.is_owned = (o & 1) || (o == 0);
17637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17638 o_conv = NodeAnnouncementInfo_clone(&o_conv);
17639 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17640 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
17641 return (uint64_t)ret_conv;
17644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17645 LDKDecodeError e_conv;
17646 e_conv.inner = (void*)(e & (~1));
17647 e_conv.is_owned = (e & 1) || (e == 0);
17648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17649 e_conv = DecodeError_clone(&e_conv);
17650 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17651 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
17652 return (uint64_t)ret_conv;
17655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17656 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
17657 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
17661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17662 if ((_res & 1) != 0) return;
17663 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17664 CHECK_ACCESS(_res_ptr);
17665 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
17667 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
17670 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17671 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17672 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17673 return (uint64_t)ret_conv;
17675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17676 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
17677 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17682 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
17683 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17684 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17685 return (uint64_t)ret_conv;
17688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17689 LDKCVec_u64Z _res_constr;
17690 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17691 if (_res_constr.datalen > 0)
17692 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17694 _res_constr.data = NULL;
17695 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17696 for (size_t g = 0; g < _res_constr.datalen; g++) {
17697 int64_t _res_conv_6 = _res_vals[g];
17698 _res_constr.data[g] = _res_conv_6;
17700 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17701 CVec_u64Z_free(_res_constr);
17704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17705 LDKNodeInfo o_conv;
17706 o_conv.inner = (void*)(o & (~1));
17707 o_conv.is_owned = (o & 1) || (o == 0);
17708 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17709 o_conv = NodeInfo_clone(&o_conv);
17710 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17711 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17712 return (uint64_t)ret_conv;
17715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17716 LDKDecodeError e_conv;
17717 e_conv.inner = (void*)(e & (~1));
17718 e_conv.is_owned = (e & 1) || (e == 0);
17719 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17720 e_conv = DecodeError_clone(&e_conv);
17721 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17722 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17723 return (uint64_t)ret_conv;
17726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17727 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
17728 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17733 if ((_res & 1) != 0) return;
17734 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17735 CHECK_ACCESS(_res_ptr);
17736 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17738 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17741 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17742 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17743 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17744 return (uint64_t)ret_conv;
17746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17747 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
17748 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17753 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
17754 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17755 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17756 return (uint64_t)ret_conv;
17759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17760 LDKNetworkGraph o_conv;
17761 o_conv.inner = (void*)(o & (~1));
17762 o_conv.is_owned = (o & 1) || (o == 0);
17763 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17764 o_conv = NetworkGraph_clone(&o_conv);
17765 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17766 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17767 return (uint64_t)ret_conv;
17770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17771 LDKDecodeError e_conv;
17772 e_conv.inner = (void*)(e & (~1));
17773 e_conv.is_owned = (e & 1) || (e == 0);
17774 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17775 e_conv = DecodeError_clone(&e_conv);
17776 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17777 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17778 return (uint64_t)ret_conv;
17781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17782 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
17783 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17788 if ((_res & 1) != 0) return;
17789 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17790 CHECK_ACCESS(_res_ptr);
17791 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17793 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17796 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
17797 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17798 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
17799 return (uint64_t)ret_conv;
17801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17802 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
17803 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
17807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17808 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
17809 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17810 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
17811 return (uint64_t)ret_conv;
17814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
17815 LDKCVec_NetAddressZ o_constr;
17816 o_constr.datalen = (*env)->GetArrayLength(env, o);
17817 if (o_constr.datalen > 0)
17818 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17820 o_constr.data = NULL;
17821 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17822 for (size_t m = 0; m < o_constr.datalen; m++) {
17823 int64_t o_conv_12 = o_vals[m];
17824 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
17825 CHECK_ACCESS(o_conv_12_ptr);
17826 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17827 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
17828 o_constr.data[m] = o_conv_12_conv;
17830 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17831 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17832 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17833 uint64_t ret_ref = (uint64_t)ret_copy;
17837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
17838 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17839 *ret_copy = COption_CVec_NetAddressZZ_none();
17840 uint64_t ret_ref = (uint64_t)ret_copy;
17844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17845 if ((_res & 1) != 0) return;
17846 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17847 CHECK_ACCESS(_res_ptr);
17848 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17850 COption_CVec_NetAddressZZ_free(_res_conv);
17853 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17854 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17855 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17856 uint64_t ret_ref = (uint64_t)ret_copy;
17859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17860 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
17861 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17866 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
17867 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17868 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17869 uint64_t ret_ref = (uint64_t)ret_copy;
17873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17874 void* o_ptr = (void*)(((uint64_t)o) & ~1);
17875 CHECK_ACCESS(o_ptr);
17876 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17877 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
17878 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17879 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17880 return (uint64_t)ret_conv;
17883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17884 LDKDecodeError e_conv;
17885 e_conv.inner = (void*)(e & (~1));
17886 e_conv.is_owned = (e & 1) || (e == 0);
17887 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17888 e_conv = DecodeError_clone(&e_conv);
17889 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17890 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17891 return (uint64_t)ret_conv;
17894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17895 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17896 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17901 if ((_res & 1) != 0) return;
17902 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
17903 CHECK_ACCESS(_res_ptr);
17904 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17906 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17909 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17910 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17911 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17912 return (uint64_t)ret_conv;
17914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17915 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17916 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17921 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17922 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17923 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17924 return (uint64_t)ret_conv;
17927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17928 LDKCVec_UpdateAddHTLCZ _res_constr;
17929 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17930 if (_res_constr.datalen > 0)
17931 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17933 _res_constr.data = NULL;
17934 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17935 for (size_t p = 0; p < _res_constr.datalen; p++) {
17936 int64_t _res_conv_15 = _res_vals[p];
17937 LDKUpdateAddHTLC _res_conv_15_conv;
17938 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17939 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17940 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17941 _res_constr.data[p] = _res_conv_15_conv;
17943 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17944 CVec_UpdateAddHTLCZ_free(_res_constr);
17947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17948 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17949 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17950 if (_res_constr.datalen > 0)
17951 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17953 _res_constr.data = NULL;
17954 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17955 for (size_t t = 0; t < _res_constr.datalen; t++) {
17956 int64_t _res_conv_19 = _res_vals[t];
17957 LDKUpdateFulfillHTLC _res_conv_19_conv;
17958 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17959 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17960 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17961 _res_constr.data[t] = _res_conv_19_conv;
17963 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17964 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17968 LDKCVec_UpdateFailHTLCZ _res_constr;
17969 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17970 if (_res_constr.datalen > 0)
17971 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17973 _res_constr.data = NULL;
17974 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17975 for (size_t q = 0; q < _res_constr.datalen; q++) {
17976 int64_t _res_conv_16 = _res_vals[q];
17977 LDKUpdateFailHTLC _res_conv_16_conv;
17978 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
17979 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
17980 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17981 _res_constr.data[q] = _res_conv_16_conv;
17983 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17984 CVec_UpdateFailHTLCZ_free(_res_constr);
17987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17988 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17989 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17990 if (_res_constr.datalen > 0)
17991 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17993 _res_constr.data = NULL;
17994 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17995 for (size_t z = 0; z < _res_constr.datalen; z++) {
17996 int64_t _res_conv_25 = _res_vals[z];
17997 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17998 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
17999 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
18000 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18001 _res_constr.data[z] = _res_conv_25_conv;
18003 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18004 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18008 LDKAcceptChannel o_conv;
18009 o_conv.inner = (void*)(o & (~1));
18010 o_conv.is_owned = (o & 1) || (o == 0);
18011 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18012 o_conv = AcceptChannel_clone(&o_conv);
18013 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18014 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18015 return (uint64_t)ret_conv;
18018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18019 LDKDecodeError e_conv;
18020 e_conv.inner = (void*)(e & (~1));
18021 e_conv.is_owned = (e & 1) || (e == 0);
18022 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18023 e_conv = DecodeError_clone(&e_conv);
18024 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18025 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18026 return (uint64_t)ret_conv;
18029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18030 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
18031 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18036 if ((_res & 1) != 0) return;
18037 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18038 CHECK_ACCESS(_res_ptr);
18039 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18041 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18044 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18045 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18046 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18047 return (uint64_t)ret_conv;
18049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18050 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
18051 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18056 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
18057 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18058 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18059 return (uint64_t)ret_conv;
18062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18063 LDKAnnouncementSignatures o_conv;
18064 o_conv.inner = (void*)(o & (~1));
18065 o_conv.is_owned = (o & 1) || (o == 0);
18066 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18067 o_conv = AnnouncementSignatures_clone(&o_conv);
18068 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18069 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18070 return (uint64_t)ret_conv;
18073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18074 LDKDecodeError e_conv;
18075 e_conv.inner = (void*)(e & (~1));
18076 e_conv.is_owned = (e & 1) || (e == 0);
18077 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18078 e_conv = DecodeError_clone(&e_conv);
18079 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18080 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18081 return (uint64_t)ret_conv;
18084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18085 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
18086 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18091 if ((_res & 1) != 0) return;
18092 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18093 CHECK_ACCESS(_res_ptr);
18094 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18096 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18099 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18100 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18101 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18102 return (uint64_t)ret_conv;
18104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18105 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
18106 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18111 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
18112 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18113 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18114 return (uint64_t)ret_conv;
18117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18118 LDKChannelReestablish o_conv;
18119 o_conv.inner = (void*)(o & (~1));
18120 o_conv.is_owned = (o & 1) || (o == 0);
18121 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18122 o_conv = ChannelReestablish_clone(&o_conv);
18123 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18124 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18125 return (uint64_t)ret_conv;
18128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18129 LDKDecodeError e_conv;
18130 e_conv.inner = (void*)(e & (~1));
18131 e_conv.is_owned = (e & 1) || (e == 0);
18132 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18133 e_conv = DecodeError_clone(&e_conv);
18134 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18135 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18136 return (uint64_t)ret_conv;
18139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18140 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
18141 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18146 if ((_res & 1) != 0) return;
18147 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18148 CHECK_ACCESS(_res_ptr);
18149 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18151 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18154 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18155 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18156 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18157 return (uint64_t)ret_conv;
18159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18160 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
18161 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18166 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
18167 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18168 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18169 return (uint64_t)ret_conv;
18172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18173 LDKClosingSigned o_conv;
18174 o_conv.inner = (void*)(o & (~1));
18175 o_conv.is_owned = (o & 1) || (o == 0);
18176 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18177 o_conv = ClosingSigned_clone(&o_conv);
18178 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18179 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18180 return (uint64_t)ret_conv;
18183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18184 LDKDecodeError e_conv;
18185 e_conv.inner = (void*)(e & (~1));
18186 e_conv.is_owned = (e & 1) || (e == 0);
18187 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18188 e_conv = DecodeError_clone(&e_conv);
18189 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18190 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18191 return (uint64_t)ret_conv;
18194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18195 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
18196 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18201 if ((_res & 1) != 0) return;
18202 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18203 CHECK_ACCESS(_res_ptr);
18204 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18206 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18209 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18210 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18211 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18212 return (uint64_t)ret_conv;
18214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18215 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
18216 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18221 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
18222 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18223 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18224 return (uint64_t)ret_conv;
18227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18228 LDKClosingSignedFeeRange o_conv;
18229 o_conv.inner = (void*)(o & (~1));
18230 o_conv.is_owned = (o & 1) || (o == 0);
18231 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18232 o_conv = ClosingSignedFeeRange_clone(&o_conv);
18233 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18234 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18235 return (uint64_t)ret_conv;
18238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18239 LDKDecodeError e_conv;
18240 e_conv.inner = (void*)(e & (~1));
18241 e_conv.is_owned = (e & 1) || (e == 0);
18242 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18243 e_conv = DecodeError_clone(&e_conv);
18244 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18245 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18246 return (uint64_t)ret_conv;
18249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18250 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
18251 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18256 if ((_res & 1) != 0) return;
18257 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18258 CHECK_ACCESS(_res_ptr);
18259 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
18261 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
18264 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
18265 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18266 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
18267 return (uint64_t)ret_conv;
18269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18270 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
18271 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
18275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18276 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
18277 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18278 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
18279 return (uint64_t)ret_conv;
18282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18283 LDKCommitmentSigned o_conv;
18284 o_conv.inner = (void*)(o & (~1));
18285 o_conv.is_owned = (o & 1) || (o == 0);
18286 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18287 o_conv = CommitmentSigned_clone(&o_conv);
18288 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18289 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
18290 return (uint64_t)ret_conv;
18293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18294 LDKDecodeError e_conv;
18295 e_conv.inner = (void*)(e & (~1));
18296 e_conv.is_owned = (e & 1) || (e == 0);
18297 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18298 e_conv = DecodeError_clone(&e_conv);
18299 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18300 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
18301 return (uint64_t)ret_conv;
18304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18305 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
18306 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
18310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18311 if ((_res & 1) != 0) return;
18312 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18313 CHECK_ACCESS(_res_ptr);
18314 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
18316 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
18319 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
18320 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18321 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
18322 return (uint64_t)ret_conv;
18324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18325 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
18326 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
18330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18331 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
18332 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18333 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
18334 return (uint64_t)ret_conv;
18337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18338 LDKFundingCreated o_conv;
18339 o_conv.inner = (void*)(o & (~1));
18340 o_conv.is_owned = (o & 1) || (o == 0);
18341 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18342 o_conv = FundingCreated_clone(&o_conv);
18343 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18344 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
18345 return (uint64_t)ret_conv;
18348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18349 LDKDecodeError e_conv;
18350 e_conv.inner = (void*)(e & (~1));
18351 e_conv.is_owned = (e & 1) || (e == 0);
18352 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18353 e_conv = DecodeError_clone(&e_conv);
18354 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18355 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
18356 return (uint64_t)ret_conv;
18359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18360 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
18361 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
18365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18366 if ((_res & 1) != 0) return;
18367 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18368 CHECK_ACCESS(_res_ptr);
18369 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
18371 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
18374 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
18375 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18376 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
18377 return (uint64_t)ret_conv;
18379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18380 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
18381 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
18385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18386 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
18387 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18388 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
18389 return (uint64_t)ret_conv;
18392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18393 LDKFundingSigned o_conv;
18394 o_conv.inner = (void*)(o & (~1));
18395 o_conv.is_owned = (o & 1) || (o == 0);
18396 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18397 o_conv = FundingSigned_clone(&o_conv);
18398 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18399 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
18400 return (uint64_t)ret_conv;
18403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18404 LDKDecodeError e_conv;
18405 e_conv.inner = (void*)(e & (~1));
18406 e_conv.is_owned = (e & 1) || (e == 0);
18407 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18408 e_conv = DecodeError_clone(&e_conv);
18409 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18410 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
18411 return (uint64_t)ret_conv;
18414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18415 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
18416 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
18420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18421 if ((_res & 1) != 0) return;
18422 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18423 CHECK_ACCESS(_res_ptr);
18424 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
18426 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
18429 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
18430 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18431 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
18432 return (uint64_t)ret_conv;
18434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18435 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
18436 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
18440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18441 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
18442 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18443 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
18444 return (uint64_t)ret_conv;
18447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18448 LDKFundingLocked o_conv;
18449 o_conv.inner = (void*)(o & (~1));
18450 o_conv.is_owned = (o & 1) || (o == 0);
18451 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18452 o_conv = FundingLocked_clone(&o_conv);
18453 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18454 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
18455 return (uint64_t)ret_conv;
18458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18459 LDKDecodeError e_conv;
18460 e_conv.inner = (void*)(e & (~1));
18461 e_conv.is_owned = (e & 1) || (e == 0);
18462 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18463 e_conv = DecodeError_clone(&e_conv);
18464 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18465 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
18466 return (uint64_t)ret_conv;
18469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18470 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
18471 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
18475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18476 if ((_res & 1) != 0) return;
18477 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18478 CHECK_ACCESS(_res_ptr);
18479 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
18481 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
18484 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
18485 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18486 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
18487 return (uint64_t)ret_conv;
18489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18490 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
18491 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
18495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18496 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
18497 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18498 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
18499 return (uint64_t)ret_conv;
18502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18504 o_conv.inner = (void*)(o & (~1));
18505 o_conv.is_owned = (o & 1) || (o == 0);
18506 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18507 o_conv = Init_clone(&o_conv);
18508 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18509 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
18510 return (uint64_t)ret_conv;
18513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18514 LDKDecodeError e_conv;
18515 e_conv.inner = (void*)(e & (~1));
18516 e_conv.is_owned = (e & 1) || (e == 0);
18517 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18518 e_conv = DecodeError_clone(&e_conv);
18519 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18520 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
18521 return (uint64_t)ret_conv;
18524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18525 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
18526 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
18530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18531 if ((_res & 1) != 0) return;
18532 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18533 CHECK_ACCESS(_res_ptr);
18534 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
18536 CResult_InitDecodeErrorZ_free(_res_conv);
18539 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
18540 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18541 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
18542 return (uint64_t)ret_conv;
18544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18545 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
18546 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
18550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18551 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
18552 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18553 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
18554 return (uint64_t)ret_conv;
18557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18558 LDKOpenChannel o_conv;
18559 o_conv.inner = (void*)(o & (~1));
18560 o_conv.is_owned = (o & 1) || (o == 0);
18561 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18562 o_conv = OpenChannel_clone(&o_conv);
18563 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18564 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
18565 return (uint64_t)ret_conv;
18568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18569 LDKDecodeError e_conv;
18570 e_conv.inner = (void*)(e & (~1));
18571 e_conv.is_owned = (e & 1) || (e == 0);
18572 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18573 e_conv = DecodeError_clone(&e_conv);
18574 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18575 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
18576 return (uint64_t)ret_conv;
18579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18580 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
18581 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
18585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18586 if ((_res & 1) != 0) return;
18587 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18588 CHECK_ACCESS(_res_ptr);
18589 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18591 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18594 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18595 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18596 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18597 return (uint64_t)ret_conv;
18599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18600 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
18601 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18606 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
18607 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18608 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18609 return (uint64_t)ret_conv;
18612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18613 LDKRevokeAndACK o_conv;
18614 o_conv.inner = (void*)(o & (~1));
18615 o_conv.is_owned = (o & 1) || (o == 0);
18616 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18617 o_conv = RevokeAndACK_clone(&o_conv);
18618 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18619 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18620 return (uint64_t)ret_conv;
18623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18624 LDKDecodeError e_conv;
18625 e_conv.inner = (void*)(e & (~1));
18626 e_conv.is_owned = (e & 1) || (e == 0);
18627 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18628 e_conv = DecodeError_clone(&e_conv);
18629 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18630 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18631 return (uint64_t)ret_conv;
18634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18635 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
18636 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18641 if ((_res & 1) != 0) return;
18642 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18643 CHECK_ACCESS(_res_ptr);
18644 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18646 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18649 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18650 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18651 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18652 return (uint64_t)ret_conv;
18654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18655 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
18656 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18661 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
18662 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18663 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18664 return (uint64_t)ret_conv;
18667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18668 LDKShutdown o_conv;
18669 o_conv.inner = (void*)(o & (~1));
18670 o_conv.is_owned = (o & 1) || (o == 0);
18671 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18672 o_conv = Shutdown_clone(&o_conv);
18673 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18674 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18675 return (uint64_t)ret_conv;
18678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18679 LDKDecodeError e_conv;
18680 e_conv.inner = (void*)(e & (~1));
18681 e_conv.is_owned = (e & 1) || (e == 0);
18682 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18683 e_conv = DecodeError_clone(&e_conv);
18684 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18685 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18686 return (uint64_t)ret_conv;
18689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18690 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
18691 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18696 if ((_res & 1) != 0) return;
18697 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18698 CHECK_ACCESS(_res_ptr);
18699 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18701 CResult_ShutdownDecodeErrorZ_free(_res_conv);
18704 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18705 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18706 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18707 return (uint64_t)ret_conv;
18709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18710 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
18711 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18716 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
18717 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18718 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18719 return (uint64_t)ret_conv;
18722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18723 LDKUpdateFailHTLC o_conv;
18724 o_conv.inner = (void*)(o & (~1));
18725 o_conv.is_owned = (o & 1) || (o == 0);
18726 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18727 o_conv = UpdateFailHTLC_clone(&o_conv);
18728 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18729 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18730 return (uint64_t)ret_conv;
18733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18734 LDKDecodeError e_conv;
18735 e_conv.inner = (void*)(e & (~1));
18736 e_conv.is_owned = (e & 1) || (e == 0);
18737 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18738 e_conv = DecodeError_clone(&e_conv);
18739 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18740 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18741 return (uint64_t)ret_conv;
18744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18745 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
18746 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18751 if ((_res & 1) != 0) return;
18752 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18753 CHECK_ACCESS(_res_ptr);
18754 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18756 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18759 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18760 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18761 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18762 return (uint64_t)ret_conv;
18764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18765 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
18766 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18771 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
18772 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18773 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18774 return (uint64_t)ret_conv;
18777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18778 LDKUpdateFailMalformedHTLC o_conv;
18779 o_conv.inner = (void*)(o & (~1));
18780 o_conv.is_owned = (o & 1) || (o == 0);
18781 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18782 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18783 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18784 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18785 return (uint64_t)ret_conv;
18788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18789 LDKDecodeError e_conv;
18790 e_conv.inner = (void*)(e & (~1));
18791 e_conv.is_owned = (e & 1) || (e == 0);
18792 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18793 e_conv = DecodeError_clone(&e_conv);
18794 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18795 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18796 return (uint64_t)ret_conv;
18799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18800 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
18801 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18806 if ((_res & 1) != 0) return;
18807 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18808 CHECK_ACCESS(_res_ptr);
18809 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18811 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18814 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18815 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18816 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18817 return (uint64_t)ret_conv;
18819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18820 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
18821 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18826 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
18827 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18828 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18829 return (uint64_t)ret_conv;
18832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18833 LDKUpdateFee o_conv;
18834 o_conv.inner = (void*)(o & (~1));
18835 o_conv.is_owned = (o & 1) || (o == 0);
18836 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18837 o_conv = UpdateFee_clone(&o_conv);
18838 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18839 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18840 return (uint64_t)ret_conv;
18843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18844 LDKDecodeError e_conv;
18845 e_conv.inner = (void*)(e & (~1));
18846 e_conv.is_owned = (e & 1) || (e == 0);
18847 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18848 e_conv = DecodeError_clone(&e_conv);
18849 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18850 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18851 return (uint64_t)ret_conv;
18854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18855 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18856 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18861 if ((_res & 1) != 0) return;
18862 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18863 CHECK_ACCESS(_res_ptr);
18864 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18866 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18869 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18870 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18871 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18872 return (uint64_t)ret_conv;
18874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18875 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18876 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18881 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18882 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18883 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18884 return (uint64_t)ret_conv;
18887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18888 LDKUpdateFulfillHTLC o_conv;
18889 o_conv.inner = (void*)(o & (~1));
18890 o_conv.is_owned = (o & 1) || (o == 0);
18891 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18892 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18893 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18894 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18895 return (uint64_t)ret_conv;
18898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18899 LDKDecodeError e_conv;
18900 e_conv.inner = (void*)(e & (~1));
18901 e_conv.is_owned = (e & 1) || (e == 0);
18902 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18903 e_conv = DecodeError_clone(&e_conv);
18904 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18905 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18906 return (uint64_t)ret_conv;
18909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18910 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18911 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18916 if ((_res & 1) != 0) return;
18917 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18918 CHECK_ACCESS(_res_ptr);
18919 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18921 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18924 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18925 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18926 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18927 return (uint64_t)ret_conv;
18929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18930 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18931 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18936 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18937 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18938 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18939 return (uint64_t)ret_conv;
18942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18943 LDKUpdateAddHTLC o_conv;
18944 o_conv.inner = (void*)(o & (~1));
18945 o_conv.is_owned = (o & 1) || (o == 0);
18946 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18947 o_conv = UpdateAddHTLC_clone(&o_conv);
18948 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18949 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18950 return (uint64_t)ret_conv;
18953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18954 LDKDecodeError e_conv;
18955 e_conv.inner = (void*)(e & (~1));
18956 e_conv.is_owned = (e & 1) || (e == 0);
18957 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18958 e_conv = DecodeError_clone(&e_conv);
18959 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18960 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18961 return (uint64_t)ret_conv;
18964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18965 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18966 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18971 if ((_res & 1) != 0) return;
18972 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
18973 CHECK_ACCESS(_res_ptr);
18974 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18976 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18979 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18980 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18981 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18982 return (uint64_t)ret_conv;
18984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18985 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
18986 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18991 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
18992 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18993 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18994 return (uint64_t)ret_conv;
18997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18999 o_conv.inner = (void*)(o & (~1));
19000 o_conv.is_owned = (o & 1) || (o == 0);
19001 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19002 o_conv = Ping_clone(&o_conv);
19003 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19004 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19005 return (uint64_t)ret_conv;
19008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19009 LDKDecodeError e_conv;
19010 e_conv.inner = (void*)(e & (~1));
19011 e_conv.is_owned = (e & 1) || (e == 0);
19012 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19013 e_conv = DecodeError_clone(&e_conv);
19014 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19015 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19016 return (uint64_t)ret_conv;
19019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19020 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
19021 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
19025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19026 if ((_res & 1) != 0) return;
19027 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19028 CHECK_ACCESS(_res_ptr);
19029 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19031 CResult_PingDecodeErrorZ_free(_res_conv);
19034 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19035 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19036 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19037 return (uint64_t)ret_conv;
19039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19040 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
19041 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19046 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
19047 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19048 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19049 return (uint64_t)ret_conv;
19052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19054 o_conv.inner = (void*)(o & (~1));
19055 o_conv.is_owned = (o & 1) || (o == 0);
19056 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19057 o_conv = Pong_clone(&o_conv);
19058 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19059 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19060 return (uint64_t)ret_conv;
19063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19064 LDKDecodeError e_conv;
19065 e_conv.inner = (void*)(e & (~1));
19066 e_conv.is_owned = (e & 1) || (e == 0);
19067 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19068 e_conv = DecodeError_clone(&e_conv);
19069 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19070 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19071 return (uint64_t)ret_conv;
19074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19075 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
19076 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
19080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19081 if ((_res & 1) != 0) return;
19082 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19083 CHECK_ACCESS(_res_ptr);
19084 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19086 CResult_PongDecodeErrorZ_free(_res_conv);
19089 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19090 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19091 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19092 return (uint64_t)ret_conv;
19094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19095 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
19096 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19101 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
19102 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19103 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19104 return (uint64_t)ret_conv;
19107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19108 LDKUnsignedChannelAnnouncement o_conv;
19109 o_conv.inner = (void*)(o & (~1));
19110 o_conv.is_owned = (o & 1) || (o == 0);
19111 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19112 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19113 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19114 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19115 return (uint64_t)ret_conv;
19118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19119 LDKDecodeError e_conv;
19120 e_conv.inner = (void*)(e & (~1));
19121 e_conv.is_owned = (e & 1) || (e == 0);
19122 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19123 e_conv = DecodeError_clone(&e_conv);
19124 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19125 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19126 return (uint64_t)ret_conv;
19129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19130 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
19131 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19136 if ((_res & 1) != 0) return;
19137 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19138 CHECK_ACCESS(_res_ptr);
19139 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19141 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19144 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19145 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19146 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19147 return (uint64_t)ret_conv;
19149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19150 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19151 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19156 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19157 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19158 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19159 return (uint64_t)ret_conv;
19162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19163 LDKChannelAnnouncement o_conv;
19164 o_conv.inner = (void*)(o & (~1));
19165 o_conv.is_owned = (o & 1) || (o == 0);
19166 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19167 o_conv = ChannelAnnouncement_clone(&o_conv);
19168 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19169 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19170 return (uint64_t)ret_conv;
19173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19174 LDKDecodeError e_conv;
19175 e_conv.inner = (void*)(e & (~1));
19176 e_conv.is_owned = (e & 1) || (e == 0);
19177 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19178 e_conv = DecodeError_clone(&e_conv);
19179 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19180 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19181 return (uint64_t)ret_conv;
19184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19185 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
19186 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19191 if ((_res & 1) != 0) return;
19192 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19193 CHECK_ACCESS(_res_ptr);
19194 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19196 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19199 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19200 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19201 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19202 return (uint64_t)ret_conv;
19204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19205 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19206 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19211 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19212 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19213 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19214 return (uint64_t)ret_conv;
19217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19218 LDKUnsignedChannelUpdate o_conv;
19219 o_conv.inner = (void*)(o & (~1));
19220 o_conv.is_owned = (o & 1) || (o == 0);
19221 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19222 o_conv = UnsignedChannelUpdate_clone(&o_conv);
19223 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19224 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
19225 return (uint64_t)ret_conv;
19228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19229 LDKDecodeError e_conv;
19230 e_conv.inner = (void*)(e & (~1));
19231 e_conv.is_owned = (e & 1) || (e == 0);
19232 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19233 e_conv = DecodeError_clone(&e_conv);
19234 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19235 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
19236 return (uint64_t)ret_conv;
19239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19240 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
19241 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
19245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19246 if ((_res & 1) != 0) return;
19247 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19248 CHECK_ACCESS(_res_ptr);
19249 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
19251 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
19254 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19255 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19256 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
19257 return (uint64_t)ret_conv;
19259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19260 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
19261 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19266 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
19267 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19268 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
19269 return (uint64_t)ret_conv;
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19273 LDKChannelUpdate o_conv;
19274 o_conv.inner = (void*)(o & (~1));
19275 o_conv.is_owned = (o & 1) || (o == 0);
19276 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19277 o_conv = ChannelUpdate_clone(&o_conv);
19278 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19279 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
19280 return (uint64_t)ret_conv;
19283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19284 LDKDecodeError e_conv;
19285 e_conv.inner = (void*)(e & (~1));
19286 e_conv.is_owned = (e & 1) || (e == 0);
19287 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19288 e_conv = DecodeError_clone(&e_conv);
19289 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19290 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
19291 return (uint64_t)ret_conv;
19294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19295 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
19296 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
19300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19301 if ((_res & 1) != 0) return;
19302 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19303 CHECK_ACCESS(_res_ptr);
19304 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
19306 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
19309 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19310 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19311 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
19312 return (uint64_t)ret_conv;
19314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19315 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
19316 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19321 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
19322 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19323 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
19324 return (uint64_t)ret_conv;
19327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19328 LDKErrorMessage o_conv;
19329 o_conv.inner = (void*)(o & (~1));
19330 o_conv.is_owned = (o & 1) || (o == 0);
19331 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19332 o_conv = ErrorMessage_clone(&o_conv);
19333 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19334 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
19335 return (uint64_t)ret_conv;
19338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19339 LDKDecodeError e_conv;
19340 e_conv.inner = (void*)(e & (~1));
19341 e_conv.is_owned = (e & 1) || (e == 0);
19342 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19343 e_conv = DecodeError_clone(&e_conv);
19344 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19345 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
19346 return (uint64_t)ret_conv;
19349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19350 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
19351 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
19355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19356 if ((_res & 1) != 0) return;
19357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19358 CHECK_ACCESS(_res_ptr);
19359 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
19361 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
19364 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
19365 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19366 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
19367 return (uint64_t)ret_conv;
19369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19370 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
19371 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
19375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19376 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
19377 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19378 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
19379 return (uint64_t)ret_conv;
19382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19383 LDKUnsignedNodeAnnouncement o_conv;
19384 o_conv.inner = (void*)(o & (~1));
19385 o_conv.is_owned = (o & 1) || (o == 0);
19386 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19387 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
19388 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19389 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
19390 return (uint64_t)ret_conv;
19393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19394 LDKDecodeError e_conv;
19395 e_conv.inner = (void*)(e & (~1));
19396 e_conv.is_owned = (e & 1) || (e == 0);
19397 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19398 e_conv = DecodeError_clone(&e_conv);
19399 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19400 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
19401 return (uint64_t)ret_conv;
19404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19405 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
19406 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19411 if ((_res & 1) != 0) return;
19412 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19413 CHECK_ACCESS(_res_ptr);
19414 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
19416 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
19419 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19420 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19421 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
19422 return (uint64_t)ret_conv;
19424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19425 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
19426 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19431 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
19432 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19433 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
19434 return (uint64_t)ret_conv;
19437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19438 LDKNodeAnnouncement o_conv;
19439 o_conv.inner = (void*)(o & (~1));
19440 o_conv.is_owned = (o & 1) || (o == 0);
19441 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19442 o_conv = NodeAnnouncement_clone(&o_conv);
19443 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19444 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
19445 return (uint64_t)ret_conv;
19448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19449 LDKDecodeError e_conv;
19450 e_conv.inner = (void*)(e & (~1));
19451 e_conv.is_owned = (e & 1) || (e == 0);
19452 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19453 e_conv = DecodeError_clone(&e_conv);
19454 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19455 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
19456 return (uint64_t)ret_conv;
19459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19460 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
19461 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19466 if ((_res & 1) != 0) return;
19467 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19468 CHECK_ACCESS(_res_ptr);
19469 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
19471 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
19474 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19475 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19476 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
19477 return (uint64_t)ret_conv;
19479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19480 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
19481 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19486 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
19487 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19488 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
19489 return (uint64_t)ret_conv;
19492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19493 LDKQueryShortChannelIds o_conv;
19494 o_conv.inner = (void*)(o & (~1));
19495 o_conv.is_owned = (o & 1) || (o == 0);
19496 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19497 o_conv = QueryShortChannelIds_clone(&o_conv);
19498 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19499 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
19500 return (uint64_t)ret_conv;
19503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19504 LDKDecodeError e_conv;
19505 e_conv.inner = (void*)(e & (~1));
19506 e_conv.is_owned = (e & 1) || (e == 0);
19507 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19508 e_conv = DecodeError_clone(&e_conv);
19509 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19510 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
19511 return (uint64_t)ret_conv;
19514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19515 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
19516 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
19520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19521 if ((_res & 1) != 0) return;
19522 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19523 CHECK_ACCESS(_res_ptr);
19524 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
19526 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
19529 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
19530 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19531 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
19532 return (uint64_t)ret_conv;
19534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19535 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
19536 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19541 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
19542 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19543 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19544 return (uint64_t)ret_conv;
19547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19548 LDKReplyShortChannelIdsEnd o_conv;
19549 o_conv.inner = (void*)(o & (~1));
19550 o_conv.is_owned = (o & 1) || (o == 0);
19551 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19552 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19553 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19554 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19555 return (uint64_t)ret_conv;
19558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19559 LDKDecodeError e_conv;
19560 e_conv.inner = (void*)(e & (~1));
19561 e_conv.is_owned = (e & 1) || (e == 0);
19562 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19563 e_conv = DecodeError_clone(&e_conv);
19564 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19565 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19566 return (uint64_t)ret_conv;
19569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19570 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
19571 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19576 if ((_res & 1) != 0) return;
19577 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19578 CHECK_ACCESS(_res_ptr);
19579 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19581 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19584 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19585 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19586 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19587 return (uint64_t)ret_conv;
19589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19590 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
19591 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19596 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
19597 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19598 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19599 return (uint64_t)ret_conv;
19602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19603 LDKQueryChannelRange o_conv;
19604 o_conv.inner = (void*)(o & (~1));
19605 o_conv.is_owned = (o & 1) || (o == 0);
19606 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19607 o_conv = QueryChannelRange_clone(&o_conv);
19608 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19609 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19610 return (uint64_t)ret_conv;
19613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19614 LDKDecodeError e_conv;
19615 e_conv.inner = (void*)(e & (~1));
19616 e_conv.is_owned = (e & 1) || (e == 0);
19617 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19618 e_conv = DecodeError_clone(&e_conv);
19619 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19620 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19621 return (uint64_t)ret_conv;
19624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19625 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
19626 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19631 if ((_res & 1) != 0) return;
19632 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19633 CHECK_ACCESS(_res_ptr);
19634 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19636 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19639 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19640 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19641 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19642 return (uint64_t)ret_conv;
19644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19645 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
19646 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19651 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
19652 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19653 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19654 return (uint64_t)ret_conv;
19657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19658 LDKReplyChannelRange o_conv;
19659 o_conv.inner = (void*)(o & (~1));
19660 o_conv.is_owned = (o & 1) || (o == 0);
19661 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19662 o_conv = ReplyChannelRange_clone(&o_conv);
19663 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19664 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19665 return (uint64_t)ret_conv;
19668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19669 LDKDecodeError e_conv;
19670 e_conv.inner = (void*)(e & (~1));
19671 e_conv.is_owned = (e & 1) || (e == 0);
19672 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19673 e_conv = DecodeError_clone(&e_conv);
19674 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19675 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19676 return (uint64_t)ret_conv;
19679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19680 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
19681 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19686 if ((_res & 1) != 0) return;
19687 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19688 CHECK_ACCESS(_res_ptr);
19689 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19691 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19694 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19695 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19696 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19697 return (uint64_t)ret_conv;
19699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19700 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
19701 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19706 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
19707 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19708 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19709 return (uint64_t)ret_conv;
19712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19713 LDKGossipTimestampFilter o_conv;
19714 o_conv.inner = (void*)(o & (~1));
19715 o_conv.is_owned = (o & 1) || (o == 0);
19716 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19717 o_conv = GossipTimestampFilter_clone(&o_conv);
19718 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19719 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19720 return (uint64_t)ret_conv;
19723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19724 LDKDecodeError e_conv;
19725 e_conv.inner = (void*)(e & (~1));
19726 e_conv.is_owned = (e & 1) || (e == 0);
19727 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19728 e_conv = DecodeError_clone(&e_conv);
19729 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19730 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19731 return (uint64_t)ret_conv;
19734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19735 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
19736 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19741 if ((_res & 1) != 0) return;
19742 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19743 CHECK_ACCESS(_res_ptr);
19744 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19746 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19749 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19750 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19751 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19752 return (uint64_t)ret_conv;
19754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19755 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
19756 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19761 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
19762 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19763 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19764 return (uint64_t)ret_conv;
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19769 o_conv.inner = (void*)(o & (~1));
19770 o_conv.is_owned = (o & 1) || (o == 0);
19771 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19772 o_conv = Invoice_clone(&o_conv);
19773 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19774 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19775 return (uint64_t)ret_conv;
19778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19779 void* e_ptr = (void*)(((uint64_t)e) & ~1);
19780 CHECK_ACCESS(e_ptr);
19781 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19782 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
19783 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19784 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19785 return (uint64_t)ret_conv;
19788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19789 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19790 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19795 if ((_res & 1) != 0) return;
19796 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19797 CHECK_ACCESS(_res_ptr);
19798 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19800 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19803 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19804 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19805 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19806 return (uint64_t)ret_conv;
19808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19809 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19810 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19815 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19816 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19817 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19818 return (uint64_t)ret_conv;
19821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19822 void* o_ptr = (void*)(((uint64_t)o) & ~1);
19823 CHECK_ACCESS(o_ptr);
19824 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19825 if (o_conv.free == LDKFilter_JCalls_free) {
19826 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19827 LDKFilter_JCalls_cloned(&o_conv);
19829 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19830 *ret_copy = COption_FilterZ_some(o_conv);
19831 uint64_t ret_ref = (uint64_t)ret_copy;
19835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
19836 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19837 *ret_copy = COption_FilterZ_none();
19838 uint64_t ret_ref = (uint64_t)ret_copy;
19842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19843 if ((_res & 1) != 0) return;
19844 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19845 CHECK_ACCESS(_res_ptr);
19846 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19848 COption_FilterZ_free(_res_conv);
19851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19852 LDKLockedChannelMonitor o_conv;
19853 o_conv.inner = (void*)(o & (~1));
19854 o_conv.is_owned = (o & 1) || (o == 0);
19855 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19856 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
19857 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19858 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19859 return (uint64_t)ret_conv;
19862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
19863 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19864 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19865 return (uint64_t)ret_conv;
19868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19869 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19870 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19875 if ((_res & 1) != 0) return;
19876 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
19877 CHECK_ACCESS(_res_ptr);
19878 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19880 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19884 LDKCVec_OutPointZ _res_constr;
19885 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19886 if (_res_constr.datalen > 0)
19887 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19889 _res_constr.data = NULL;
19890 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19891 for (size_t k = 0; k < _res_constr.datalen; k++) {
19892 int64_t _res_conv_10 = _res_vals[k];
19893 LDKOutPoint _res_conv_10_conv;
19894 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19895 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19896 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19897 _res_constr.data[k] = _res_conv_10_conv;
19899 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19900 CVec_OutPointZ_free(_res_constr);
19903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19904 if ((this_ptr & 1) != 0) return;
19905 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19906 CHECK_ACCESS(this_ptr_ptr);
19907 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19908 FREE((void*)this_ptr);
19909 PaymentPurpose_free(this_ptr_conv);
19912 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19913 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19914 *ret_copy = PaymentPurpose_clone(arg);
19915 uint64_t ret_ref = (uint64_t)ret_copy;
19918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19919 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
19920 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
19924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19925 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
19926 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19927 *ret_copy = PaymentPurpose_clone(orig_conv);
19928 uint64_t ret_ref = (uint64_t)ret_copy;
19932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
19933 LDKThirtyTwoBytes payment_preimage_ref;
19934 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
19935 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
19936 LDKThirtyTwoBytes payment_secret_ref;
19937 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
19938 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
19939 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19940 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19941 uint64_t ret_ref = (uint64_t)ret_copy;
19945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
19946 LDKThirtyTwoBytes a_ref;
19947 CHECK((*env)->GetArrayLength(env, a) == 32);
19948 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19949 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19950 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19951 uint64_t ret_ref = (uint64_t)ret_copy;
19955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19956 if ((this_ptr & 1) != 0) return;
19957 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19958 CHECK_ACCESS(this_ptr_ptr);
19959 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19960 FREE((void*)this_ptr);
19961 ClosureReason_free(this_ptr_conv);
19964 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
19965 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19966 *ret_copy = ClosureReason_clone(arg);
19967 uint64_t ret_ref = (uint64_t)ret_copy;
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19971 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
19972 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
19976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19977 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
19978 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19979 *ret_copy = ClosureReason_clone(orig_conv);
19980 uint64_t ret_ref = (uint64_t)ret_copy;
19984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
19985 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
19986 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19987 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
19988 uint64_t ret_ref = (uint64_t)ret_copy;
19992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
19993 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19994 *ret_copy = ClosureReason_holder_force_closed();
19995 uint64_t ret_ref = (uint64_t)ret_copy;
19999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
20000 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20001 *ret_copy = ClosureReason_cooperative_closure();
20002 uint64_t ret_ref = (uint64_t)ret_copy;
20006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
20007 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20008 *ret_copy = ClosureReason_commitment_tx_confirmed();
20009 uint64_t ret_ref = (uint64_t)ret_copy;
20013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
20014 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20015 *ret_copy = ClosureReason_funding_timed_out();
20016 uint64_t ret_ref = (uint64_t)ret_copy;
20020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
20021 LDKStr err_conv = java_to_owned_str(env, err);
20022 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20023 *ret_copy = ClosureReason_processing_error(err_conv);
20024 uint64_t ret_ref = (uint64_t)ret_copy;
20028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
20029 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20030 *ret_copy = ClosureReason_disconnected_peer();
20031 uint64_t ret_ref = (uint64_t)ret_copy;
20035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
20036 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20037 *ret_copy = ClosureReason_outdated_channel_manager();
20038 uint64_t ret_ref = (uint64_t)ret_copy;
20042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
20043 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
20044 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20045 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20046 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20047 CVec_u8Z_free(ret_var);
20051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20052 LDKu8slice ser_ref;
20053 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20054 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20055 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20056 *ret_conv = ClosureReason_read(ser_ref);
20057 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20058 return (uint64_t)ret_conv;
20061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20062 if ((this_ptr & 1) != 0) return;
20063 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20064 CHECK_ACCESS(this_ptr_ptr);
20065 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
20066 FREE((void*)this_ptr);
20067 Event_free(this_ptr_conv);
20070 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
20071 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20072 *ret_copy = Event_clone(arg);
20073 uint64_t ret_ref = (uint64_t)ret_copy;
20076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20077 LDKEvent* arg_conv = (LDKEvent*)arg;
20078 int64_t ret_val = Event_clone_ptr(arg_conv);
20082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20083 LDKEvent* orig_conv = (LDKEvent*)orig;
20084 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20085 *ret_copy = Event_clone(orig_conv);
20086 uint64_t ret_ref = (uint64_t)ret_copy;
20090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
20091 LDKThirtyTwoBytes temporary_channel_id_ref;
20092 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
20093 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
20094 LDKCVec_u8Z output_script_ref;
20095 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
20096 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
20097 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
20098 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20099 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
20100 uint64_t ret_ref = (uint64_t)ret_copy;
20104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
20105 LDKThirtyTwoBytes payment_hash_ref;
20106 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20107 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20108 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
20109 CHECK_ACCESS(purpose_ptr);
20110 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20111 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
20112 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20113 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
20114 uint64_t ret_ref = (uint64_t)ret_copy;
20118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
20119 LDKThirtyTwoBytes payment_id_ref;
20120 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
20121 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
20122 LDKThirtyTwoBytes payment_preimage_ref;
20123 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
20124 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
20125 LDKThirtyTwoBytes payment_hash_ref;
20126 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20127 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20128 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
20129 CHECK_ACCESS(fee_paid_msat_ptr);
20130 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
20131 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
20132 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20133 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
20134 uint64_t ret_ref = (uint64_t)ret_copy;
20138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
20139 LDKThirtyTwoBytes payment_id_ref;
20140 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
20141 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
20142 LDKThirtyTwoBytes payment_hash_ref;
20143 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20144 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20145 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
20146 CHECK_ACCESS(network_update_ptr);
20147 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
20148 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
20149 LDKCVec_RouteHopZ path_constr;
20150 path_constr.datalen = (*env)->GetArrayLength(env, path);
20151 if (path_constr.datalen > 0)
20152 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20154 path_constr.data = NULL;
20155 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
20156 for (size_t k = 0; k < path_constr.datalen; k++) {
20157 int64_t path_conv_10 = path_vals[k];
20158 LDKRouteHop path_conv_10_conv;
20159 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20160 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20161 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20162 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20163 path_constr.data[k] = path_conv_10_conv;
20165 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
20166 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
20167 CHECK_ACCESS(short_channel_id_ptr);
20168 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
20169 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
20170 LDKRouteParameters retry_conv;
20171 retry_conv.inner = (void*)(retry & (~1));
20172 retry_conv.is_owned = (retry & 1) || (retry == 0);
20173 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
20174 retry_conv = RouteParameters_clone(&retry_conv);
20175 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20176 *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
20177 uint64_t ret_ref = (uint64_t)ret_copy;
20181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
20182 LDKThirtyTwoBytes payment_id_ref;
20183 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
20184 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
20185 LDKThirtyTwoBytes payment_hash_ref;
20186 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20187 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20188 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20189 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
20190 uint64_t ret_ref = (uint64_t)ret_copy;
20194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
20195 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20196 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
20197 uint64_t ret_ref = (uint64_t)ret_copy;
20201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
20202 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
20203 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
20204 if (outputs_constr.datalen > 0)
20205 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20207 outputs_constr.data = NULL;
20208 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
20209 for (size_t b = 0; b < outputs_constr.datalen; b++) {
20210 int64_t outputs_conv_27 = outputs_vals[b];
20211 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
20212 CHECK_ACCESS(outputs_conv_27_ptr);
20213 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
20214 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
20215 outputs_constr.data[b] = outputs_conv_27_conv;
20217 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
20218 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20219 *ret_copy = Event_spendable_outputs(outputs_constr);
20220 uint64_t ret_ref = (uint64_t)ret_copy;
20224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
20225 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
20226 CHECK_ACCESS(fee_earned_msat_ptr);
20227 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
20228 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
20229 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20230 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
20231 uint64_t ret_ref = (uint64_t)ret_copy;
20235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) {
20236 LDKThirtyTwoBytes channel_id_ref;
20237 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
20238 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
20239 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
20240 CHECK_ACCESS(reason_ptr);
20241 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
20242 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
20243 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20244 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
20245 uint64_t ret_ref = (uint64_t)ret_copy;
20249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
20250 LDKThirtyTwoBytes channel_id_ref;
20251 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
20252 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
20253 LDKTransaction transaction_ref;
20254 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
20255 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
20256 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
20257 transaction_ref.data_is_owned = true;
20258 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20259 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
20260 uint64_t ret_ref = (uint64_t)ret_copy;
20264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
20265 LDKThirtyTwoBytes payment_id_ref;
20266 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
20267 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
20268 LDKThirtyTwoBytes payment_hash_ref;
20269 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20270 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20271 LDKCVec_RouteHopZ path_constr;
20272 path_constr.datalen = (*env)->GetArrayLength(env, path);
20273 if (path_constr.datalen > 0)
20274 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20276 path_constr.data = NULL;
20277 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
20278 for (size_t k = 0; k < path_constr.datalen; k++) {
20279 int64_t path_conv_10 = path_vals[k];
20280 LDKRouteHop path_conv_10_conv;
20281 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20282 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20283 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20284 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20285 path_constr.data[k] = path_conv_10_conv;
20287 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
20288 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20289 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
20290 uint64_t ret_ref = (uint64_t)ret_copy;
20294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
20295 LDKEvent* obj_conv = (LDKEvent*)obj;
20296 LDKCVec_u8Z ret_var = Event_write(obj_conv);
20297 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20298 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20299 CVec_u8Z_free(ret_var);
20303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20304 LDKu8slice ser_ref;
20305 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20306 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20307 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
20308 *ret_conv = Event_read(ser_ref);
20309 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20310 return (uint64_t)ret_conv;
20313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20314 if ((this_ptr & 1) != 0) return;
20315 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20316 CHECK_ACCESS(this_ptr_ptr);
20317 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20318 FREE((void*)this_ptr);
20319 MessageSendEvent_free(this_ptr_conv);
20322 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20323 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20324 *ret_copy = MessageSendEvent_clone(arg);
20325 uint64_t ret_ref = (uint64_t)ret_copy;
20328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20329 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
20330 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
20334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20335 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
20336 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20337 *ret_copy = MessageSendEvent_clone(orig_conv);
20338 uint64_t ret_ref = (uint64_t)ret_copy;
20342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20343 LDKPublicKey node_id_ref;
20344 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20345 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20346 LDKAcceptChannel msg_conv;
20347 msg_conv.inner = (void*)(msg & (~1));
20348 msg_conv.is_owned = (msg & 1) || (msg == 0);
20349 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20350 msg_conv = AcceptChannel_clone(&msg_conv);
20351 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20352 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20353 uint64_t ret_ref = (uint64_t)ret_copy;
20357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20358 LDKPublicKey node_id_ref;
20359 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20360 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20361 LDKOpenChannel msg_conv;
20362 msg_conv.inner = (void*)(msg & (~1));
20363 msg_conv.is_owned = (msg & 1) || (msg == 0);
20364 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20365 msg_conv = OpenChannel_clone(&msg_conv);
20366 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20367 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20368 uint64_t ret_ref = (uint64_t)ret_copy;
20372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20373 LDKPublicKey node_id_ref;
20374 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20375 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20376 LDKFundingCreated msg_conv;
20377 msg_conv.inner = (void*)(msg & (~1));
20378 msg_conv.is_owned = (msg & 1) || (msg == 0);
20379 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20380 msg_conv = FundingCreated_clone(&msg_conv);
20381 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20382 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20383 uint64_t ret_ref = (uint64_t)ret_copy;
20387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20388 LDKPublicKey node_id_ref;
20389 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20390 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20391 LDKFundingSigned msg_conv;
20392 msg_conv.inner = (void*)(msg & (~1));
20393 msg_conv.is_owned = (msg & 1) || (msg == 0);
20394 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20395 msg_conv = FundingSigned_clone(&msg_conv);
20396 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20397 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20398 uint64_t ret_ref = (uint64_t)ret_copy;
20402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20403 LDKPublicKey node_id_ref;
20404 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20405 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20406 LDKFundingLocked msg_conv;
20407 msg_conv.inner = (void*)(msg & (~1));
20408 msg_conv.is_owned = (msg & 1) || (msg == 0);
20409 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20410 msg_conv = FundingLocked_clone(&msg_conv);
20411 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20412 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
20413 uint64_t ret_ref = (uint64_t)ret_copy;
20417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20418 LDKPublicKey node_id_ref;
20419 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20420 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20421 LDKAnnouncementSignatures msg_conv;
20422 msg_conv.inner = (void*)(msg & (~1));
20423 msg_conv.is_owned = (msg & 1) || (msg == 0);
20424 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20425 msg_conv = AnnouncementSignatures_clone(&msg_conv);
20426 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20427 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20428 uint64_t ret_ref = (uint64_t)ret_copy;
20432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
20433 LDKPublicKey node_id_ref;
20434 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20435 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20436 LDKCommitmentUpdate updates_conv;
20437 updates_conv.inner = (void*)(updates & (~1));
20438 updates_conv.is_owned = (updates & 1) || (updates == 0);
20439 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20440 updates_conv = CommitmentUpdate_clone(&updates_conv);
20441 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20442 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20443 uint64_t ret_ref = (uint64_t)ret_copy;
20447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20448 LDKPublicKey node_id_ref;
20449 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20450 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20451 LDKRevokeAndACK msg_conv;
20452 msg_conv.inner = (void*)(msg & (~1));
20453 msg_conv.is_owned = (msg & 1) || (msg == 0);
20454 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20455 msg_conv = RevokeAndACK_clone(&msg_conv);
20456 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20457 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20458 uint64_t ret_ref = (uint64_t)ret_copy;
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20463 LDKPublicKey node_id_ref;
20464 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20465 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20466 LDKClosingSigned msg_conv;
20467 msg_conv.inner = (void*)(msg & (~1));
20468 msg_conv.is_owned = (msg & 1) || (msg == 0);
20469 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20470 msg_conv = ClosingSigned_clone(&msg_conv);
20471 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20472 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20473 uint64_t ret_ref = (uint64_t)ret_copy;
20477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20478 LDKPublicKey node_id_ref;
20479 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20480 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20481 LDKShutdown msg_conv;
20482 msg_conv.inner = (void*)(msg & (~1));
20483 msg_conv.is_owned = (msg & 1) || (msg == 0);
20484 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20485 msg_conv = Shutdown_clone(&msg_conv);
20486 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20487 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20488 uint64_t ret_ref = (uint64_t)ret_copy;
20492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20493 LDKPublicKey node_id_ref;
20494 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20495 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20496 LDKChannelReestablish msg_conv;
20497 msg_conv.inner = (void*)(msg & (~1));
20498 msg_conv.is_owned = (msg & 1) || (msg == 0);
20499 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20500 msg_conv = ChannelReestablish_clone(&msg_conv);
20501 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20502 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20503 uint64_t ret_ref = (uint64_t)ret_copy;
20507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
20508 LDKChannelAnnouncement msg_conv;
20509 msg_conv.inner = (void*)(msg & (~1));
20510 msg_conv.is_owned = (msg & 1) || (msg == 0);
20511 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20512 msg_conv = ChannelAnnouncement_clone(&msg_conv);
20513 LDKChannelUpdate update_msg_conv;
20514 update_msg_conv.inner = (void*)(update_msg & (~1));
20515 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
20516 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20517 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20518 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20519 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20520 uint64_t ret_ref = (uint64_t)ret_copy;
20524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
20525 LDKNodeAnnouncement msg_conv;
20526 msg_conv.inner = (void*)(msg & (~1));
20527 msg_conv.is_owned = (msg & 1) || (msg == 0);
20528 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20529 msg_conv = NodeAnnouncement_clone(&msg_conv);
20530 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20531 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20532 uint64_t ret_ref = (uint64_t)ret_copy;
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
20537 LDKChannelUpdate msg_conv;
20538 msg_conv.inner = (void*)(msg & (~1));
20539 msg_conv.is_owned = (msg & 1) || (msg == 0);
20540 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20541 msg_conv = ChannelUpdate_clone(&msg_conv);
20542 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20543 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20544 uint64_t ret_ref = (uint64_t)ret_copy;
20548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20549 LDKPublicKey node_id_ref;
20550 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20551 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20552 LDKChannelUpdate msg_conv;
20553 msg_conv.inner = (void*)(msg & (~1));
20554 msg_conv.is_owned = (msg & 1) || (msg == 0);
20555 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20556 msg_conv = ChannelUpdate_clone(&msg_conv);
20557 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20558 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20559 uint64_t ret_ref = (uint64_t)ret_copy;
20563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
20564 LDKPublicKey node_id_ref;
20565 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20566 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20567 void* action_ptr = (void*)(((uint64_t)action) & ~1);
20568 CHECK_ACCESS(action_ptr);
20569 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20570 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
20571 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20572 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20573 uint64_t ret_ref = (uint64_t)ret_copy;
20577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20578 LDKPublicKey node_id_ref;
20579 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20580 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20581 LDKQueryChannelRange msg_conv;
20582 msg_conv.inner = (void*)(msg & (~1));
20583 msg_conv.is_owned = (msg & 1) || (msg == 0);
20584 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20585 msg_conv = QueryChannelRange_clone(&msg_conv);
20586 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20587 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20588 uint64_t ret_ref = (uint64_t)ret_copy;
20592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20593 LDKPublicKey node_id_ref;
20594 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20595 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20596 LDKQueryShortChannelIds msg_conv;
20597 msg_conv.inner = (void*)(msg & (~1));
20598 msg_conv.is_owned = (msg & 1) || (msg == 0);
20599 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20600 msg_conv = QueryShortChannelIds_clone(&msg_conv);
20601 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20602 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20603 uint64_t ret_ref = (uint64_t)ret_copy;
20607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
20608 LDKPublicKey node_id_ref;
20609 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20610 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20611 LDKReplyChannelRange msg_conv;
20612 msg_conv.inner = (void*)(msg & (~1));
20613 msg_conv.is_owned = (msg & 1) || (msg == 0);
20614 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20615 msg_conv = ReplyChannelRange_clone(&msg_conv);
20616 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20617 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20618 uint64_t ret_ref = (uint64_t)ret_copy;
20622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20623 if ((this_ptr & 1) != 0) return;
20624 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20625 CHECK_ACCESS(this_ptr_ptr);
20626 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20627 FREE((void*)this_ptr);
20628 MessageSendEventsProvider_free(this_ptr_conv);
20631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20632 if ((this_ptr & 1) != 0) return;
20633 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20634 CHECK_ACCESS(this_ptr_ptr);
20635 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20636 FREE((void*)this_ptr);
20637 EventsProvider_free(this_ptr_conv);
20640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20641 if ((this_ptr & 1) != 0) return;
20642 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20643 CHECK_ACCESS(this_ptr_ptr);
20644 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20645 FREE((void*)this_ptr);
20646 EventHandler_free(this_ptr_conv);
20649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20650 if ((this_ptr & 1) != 0) return;
20651 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20652 CHECK_ACCESS(this_ptr_ptr);
20653 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20654 FREE((void*)this_ptr);
20655 APIError_free(this_ptr_conv);
20658 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20659 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20660 *ret_copy = APIError_clone(arg);
20661 uint64_t ret_ref = (uint64_t)ret_copy;
20664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20665 LDKAPIError* arg_conv = (LDKAPIError*)arg;
20666 int64_t ret_val = APIError_clone_ptr(arg_conv);
20670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20671 LDKAPIError* orig_conv = (LDKAPIError*)orig;
20672 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20673 *ret_copy = APIError_clone(orig_conv);
20674 uint64_t ret_ref = (uint64_t)ret_copy;
20678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
20679 LDKStr err_conv = java_to_owned_str(env, err);
20680 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20681 *ret_copy = APIError_apimisuse_error(err_conv);
20682 uint64_t ret_ref = (uint64_t)ret_copy;
20686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
20687 LDKStr err_conv = java_to_owned_str(env, err);
20688 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20689 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20690 uint64_t ret_ref = (uint64_t)ret_copy;
20694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
20695 LDKStr err_conv = java_to_owned_str(env, err);
20696 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20697 *ret_copy = APIError_route_error(err_conv);
20698 uint64_t ret_ref = (uint64_t)ret_copy;
20702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
20703 LDKStr err_conv = java_to_owned_str(env, err);
20704 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20705 *ret_copy = APIError_channel_unavailable(err_conv);
20706 uint64_t ret_ref = (uint64_t)ret_copy;
20710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
20711 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20712 *ret_copy = APIError_monitor_update_failed();
20713 uint64_t ret_ref = (uint64_t)ret_copy;
20717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
20718 LDKShutdownScript script_conv;
20719 script_conv.inner = (void*)(script & (~1));
20720 script_conv.is_owned = (script & 1) || (script == 0);
20721 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20722 script_conv = ShutdownScript_clone(&script_conv);
20723 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20724 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20725 uint64_t ret_ref = (uint64_t)ret_copy;
20729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
20730 LDKu8slice msg_ref;
20731 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
20732 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
20733 unsigned char sk_arr[32];
20734 CHECK((*env)->GetArrayLength(env, sk) == 32);
20735 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
20736 unsigned char (*sk_ref)[32] = &sk_arr;
20737 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20738 *ret_conv = sign(msg_ref, sk_ref);
20739 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
20740 return (uint64_t)ret_conv;
20743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
20744 LDKu8slice msg_ref;
20745 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
20746 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
20747 LDKStr sig_conv = java_to_owned_str(env, sig);
20748 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20749 *ret_conv = recover_pk(msg_ref, sig_conv);
20750 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
20751 return (uint64_t)ret_conv;
20754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
20755 LDKu8slice msg_ref;
20756 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
20757 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
20758 LDKStr sig_conv = java_to_owned_str(env, sig);
20759 LDKPublicKey pk_ref;
20760 CHECK((*env)->GetArrayLength(env, pk) == 33);
20761 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
20762 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
20763 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
20767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20768 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
20769 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
20773 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
20774 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
20778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
20779 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
20783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
20784 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
20788 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
20789 jclass ret_conv = LDKLevel_to_java(env, Level_info());
20793 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
20794 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
20798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
20799 jclass ret_conv = LDKLevel_to_java(env, Level_error());
20803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
20804 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
20805 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
20806 jboolean ret_val = Level_eq(a_conv, b_conv);
20810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
20811 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
20812 int64_t ret_val = Level_hash(o_conv);
20816 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
20817 jclass ret_conv = LDKLevel_to_java(env, Level_max());
20821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20822 LDKRecord this_obj_conv;
20823 this_obj_conv.inner = (void*)(this_obj & (~1));
20824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20826 Record_free(this_obj_conv);
20829 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
20830 LDKRecord this_ptr_conv;
20831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20832 this_ptr_conv.is_owned = false;
20833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20834 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
20838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
20839 LDKRecord this_ptr_conv;
20840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20841 this_ptr_conv.is_owned = false;
20842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20843 LDKLevel val_conv = LDKLevel_from_java(env, val);
20844 Record_set_level(&this_ptr_conv, val_conv);
20847 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
20848 LDKRecord this_ptr_conv;
20849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20850 this_ptr_conv.is_owned = false;
20851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20852 LDKStr ret_str = Record_get_args(&this_ptr_conv);
20853 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20859 LDKRecord this_ptr_conv;
20860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20861 this_ptr_conv.is_owned = false;
20862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20863 LDKStr val_conv = java_to_owned_str(env, val);
20864 Record_set_args(&this_ptr_conv, val_conv);
20867 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
20868 LDKRecord this_ptr_conv;
20869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20870 this_ptr_conv.is_owned = false;
20871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20872 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
20873 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20879 LDKRecord this_ptr_conv;
20880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20881 this_ptr_conv.is_owned = false;
20882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20883 LDKStr val_conv = java_to_owned_str(env, val);
20884 Record_set_module_path(&this_ptr_conv, val_conv);
20887 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
20888 LDKRecord this_ptr_conv;
20889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20890 this_ptr_conv.is_owned = false;
20891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20892 LDKStr ret_str = Record_get_file(&this_ptr_conv);
20893 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20899 LDKRecord this_ptr_conv;
20900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20901 this_ptr_conv.is_owned = false;
20902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20903 LDKStr val_conv = java_to_owned_str(env, val);
20904 Record_set_file(&this_ptr_conv, val_conv);
20907 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
20908 LDKRecord this_ptr_conv;
20909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20910 this_ptr_conv.is_owned = false;
20911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20912 int32_t ret_val = Record_get_line(&this_ptr_conv);
20916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20917 LDKRecord this_ptr_conv;
20918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20919 this_ptr_conv.is_owned = false;
20920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20921 Record_set_line(&this_ptr_conv, val);
20924 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
20925 LDKRecord ret_var = Record_clone(arg);
20926 uint64_t ret_ref = 0;
20927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20930 ret_ref = (uint64_t)ret_var.inner;
20931 if (ret_var.is_owned) {
20936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20937 LDKRecord arg_conv;
20938 arg_conv.inner = (void*)(arg & (~1));
20939 arg_conv.is_owned = false;
20940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20941 int64_t ret_val = Record_clone_ptr(&arg_conv);
20945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20946 LDKRecord orig_conv;
20947 orig_conv.inner = (void*)(orig & (~1));
20948 orig_conv.is_owned = false;
20949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20950 LDKRecord ret_var = Record_clone(&orig_conv);
20951 uint64_t ret_ref = 0;
20952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20955 ret_ref = (uint64_t)ret_var.inner;
20956 if (ret_var.is_owned) {
20962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20963 if ((this_ptr & 1) != 0) return;
20964 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20965 CHECK_ACCESS(this_ptr_ptr);
20966 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
20967 FREE((void*)this_ptr);
20968 Logger_free(this_ptr_conv);
20971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20972 LDKChannelHandshakeConfig this_obj_conv;
20973 this_obj_conv.inner = (void*)(this_obj & (~1));
20974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20976 ChannelHandshakeConfig_free(this_obj_conv);
20979 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
20980 LDKChannelHandshakeConfig this_ptr_conv;
20981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20982 this_ptr_conv.is_owned = false;
20983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20984 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
20988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20989 LDKChannelHandshakeConfig this_ptr_conv;
20990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20991 this_ptr_conv.is_owned = false;
20992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20993 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
20996 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
20997 LDKChannelHandshakeConfig this_ptr_conv;
20998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20999 this_ptr_conv.is_owned = false;
21000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21001 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
21005 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) {
21006 LDKChannelHandshakeConfig this_ptr_conv;
21007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21008 this_ptr_conv.is_owned = false;
21009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21010 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
21013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21014 LDKChannelHandshakeConfig this_ptr_conv;
21015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21016 this_ptr_conv.is_owned = false;
21017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21018 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
21022 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) {
21023 LDKChannelHandshakeConfig this_ptr_conv;
21024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21025 this_ptr_conv.is_owned = false;
21026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21027 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
21030 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) {
21031 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
21032 uint64_t ret_ref = 0;
21033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21036 ret_ref = (uint64_t)ret_var.inner;
21037 if (ret_var.is_owned) {
21043 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
21044 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
21045 uint64_t ret_ref = 0;
21046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21049 ret_ref = (uint64_t)ret_var.inner;
21050 if (ret_var.is_owned) {
21055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21056 LDKChannelHandshakeConfig arg_conv;
21057 arg_conv.inner = (void*)(arg & (~1));
21058 arg_conv.is_owned = false;
21059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21060 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
21064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21065 LDKChannelHandshakeConfig orig_conv;
21066 orig_conv.inner = (void*)(orig & (~1));
21067 orig_conv.is_owned = false;
21068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21069 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
21070 uint64_t ret_ref = 0;
21071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21074 ret_ref = (uint64_t)ret_var.inner;
21075 if (ret_var.is_owned) {
21081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
21082 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
21083 uint64_t ret_ref = 0;
21084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21087 ret_ref = (uint64_t)ret_var.inner;
21088 if (ret_var.is_owned) {
21094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21095 LDKChannelHandshakeLimits this_obj_conv;
21096 this_obj_conv.inner = (void*)(this_obj & (~1));
21097 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21099 ChannelHandshakeLimits_free(this_obj_conv);
21102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21103 LDKChannelHandshakeLimits this_ptr_conv;
21104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21105 this_ptr_conv.is_owned = false;
21106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21107 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
21111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21112 LDKChannelHandshakeLimits this_ptr_conv;
21113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21114 this_ptr_conv.is_owned = false;
21115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21116 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21120 LDKChannelHandshakeLimits this_ptr_conv;
21121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21122 this_ptr_conv.is_owned = false;
21123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21124 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21128 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) {
21129 LDKChannelHandshakeLimits this_ptr_conv;
21130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21131 this_ptr_conv.is_owned = false;
21132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21133 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21136 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) {
21137 LDKChannelHandshakeLimits this_ptr_conv;
21138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21139 this_ptr_conv.is_owned = false;
21140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21141 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21145 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) {
21146 LDKChannelHandshakeLimits this_ptr_conv;
21147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21148 this_ptr_conv.is_owned = false;
21149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21150 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21154 LDKChannelHandshakeLimits this_ptr_conv;
21155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21156 this_ptr_conv.is_owned = false;
21157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21158 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21162 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) {
21163 LDKChannelHandshakeLimits this_ptr_conv;
21164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21165 this_ptr_conv.is_owned = false;
21166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21167 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21170 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
21171 LDKChannelHandshakeLimits this_ptr_conv;
21172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21173 this_ptr_conv.is_owned = false;
21174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21175 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21179 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) {
21180 LDKChannelHandshakeLimits this_ptr_conv;
21181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21182 this_ptr_conv.is_owned = false;
21183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21184 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21187 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
21188 LDKChannelHandshakeLimits this_ptr_conv;
21189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21190 this_ptr_conv.is_owned = false;
21191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21192 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21197 LDKChannelHandshakeLimits this_ptr_conv;
21198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21199 this_ptr_conv.is_owned = false;
21200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21201 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
21205 LDKChannelHandshakeLimits this_ptr_conv;
21206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21207 this_ptr_conv.is_owned = false;
21208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21209 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21214 LDKChannelHandshakeLimits this_ptr_conv;
21215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21216 this_ptr_conv.is_owned = false;
21217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21218 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21221 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21222 LDKChannelHandshakeLimits this_ptr_conv;
21223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21224 this_ptr_conv.is_owned = false;
21225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21226 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21230 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) {
21231 LDKChannelHandshakeLimits this_ptr_conv;
21232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21233 this_ptr_conv.is_owned = false;
21234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21235 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21238 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) {
21239 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);
21240 uint64_t ret_ref = 0;
21241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21244 ret_ref = (uint64_t)ret_var.inner;
21245 if (ret_var.is_owned) {
21251 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21252 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21253 uint64_t ret_ref = 0;
21254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21257 ret_ref = (uint64_t)ret_var.inner;
21258 if (ret_var.is_owned) {
21263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21264 LDKChannelHandshakeLimits arg_conv;
21265 arg_conv.inner = (void*)(arg & (~1));
21266 arg_conv.is_owned = false;
21267 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21268 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21273 LDKChannelHandshakeLimits orig_conv;
21274 orig_conv.inner = (void*)(orig & (~1));
21275 orig_conv.is_owned = false;
21276 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21277 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21278 uint64_t ret_ref = 0;
21279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21282 ret_ref = (uint64_t)ret_var.inner;
21283 if (ret_var.is_owned) {
21289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
21290 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21291 uint64_t ret_ref = 0;
21292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21295 ret_ref = (uint64_t)ret_var.inner;
21296 if (ret_var.is_owned) {
21302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21303 LDKChannelConfig this_obj_conv;
21304 this_obj_conv.inner = (void*)(this_obj & (~1));
21305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21307 ChannelConfig_free(this_obj_conv);
21310 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
21311 LDKChannelConfig this_ptr_conv;
21312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21313 this_ptr_conv.is_owned = false;
21314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21315 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21320 LDKChannelConfig this_ptr_conv;
21321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21322 this_ptr_conv.is_owned = false;
21323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21324 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21327 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21328 LDKChannelConfig this_ptr_conv;
21329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21330 this_ptr_conv.is_owned = false;
21331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21332 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21337 LDKChannelConfig this_ptr_conv;
21338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21339 this_ptr_conv.is_owned = false;
21340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21341 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21344 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
21345 LDKChannelConfig this_ptr_conv;
21346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21347 this_ptr_conv.is_owned = false;
21348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21349 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21354 LDKChannelConfig this_ptr_conv;
21355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21356 this_ptr_conv.is_owned = false;
21357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21358 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
21362 LDKChannelConfig this_ptr_conv;
21363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21364 this_ptr_conv.is_owned = false;
21365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21366 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
21370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21371 LDKChannelConfig this_ptr_conv;
21372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21373 this_ptr_conv.is_owned = false;
21374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21375 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
21378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21379 LDKChannelConfig this_ptr_conv;
21380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21381 this_ptr_conv.is_owned = false;
21382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21383 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
21387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21388 LDKChannelConfig this_ptr_conv;
21389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21390 this_ptr_conv.is_owned = false;
21391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21392 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
21395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21396 LDKChannelConfig this_ptr_conv;
21397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21398 this_ptr_conv.is_owned = false;
21399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21400 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21405 LDKChannelConfig this_ptr_conv;
21406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21407 this_ptr_conv.is_owned = false;
21408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21409 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21413 LDKChannelConfig this_ptr_conv;
21414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21415 this_ptr_conv.is_owned = false;
21416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21417 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21422 LDKChannelConfig this_ptr_conv;
21423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21424 this_ptr_conv.is_owned = false;
21425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21426 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
21430 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
21431 uint64_t ret_ref = 0;
21432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21435 ret_ref = (uint64_t)ret_var.inner;
21436 if (ret_var.is_owned) {
21442 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21443 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21444 uint64_t ret_ref = 0;
21445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21448 ret_ref = (uint64_t)ret_var.inner;
21449 if (ret_var.is_owned) {
21454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21455 LDKChannelConfig arg_conv;
21456 arg_conv.inner = (void*)(arg & (~1));
21457 arg_conv.is_owned = false;
21458 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21459 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
21463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21464 LDKChannelConfig orig_conv;
21465 orig_conv.inner = (void*)(orig & (~1));
21466 orig_conv.is_owned = false;
21467 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21468 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21469 uint64_t ret_ref = 0;
21470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21473 ret_ref = (uint64_t)ret_var.inner;
21474 if (ret_var.is_owned) {
21480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
21481 LDKChannelConfig ret_var = ChannelConfig_default();
21482 uint64_t ret_ref = 0;
21483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21486 ret_ref = (uint64_t)ret_var.inner;
21487 if (ret_var.is_owned) {
21493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
21494 LDKChannelConfig obj_conv;
21495 obj_conv.inner = (void*)(obj & (~1));
21496 obj_conv.is_owned = false;
21497 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21498 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21506 LDKu8slice ser_ref;
21507 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21508 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21509 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21510 *ret_conv = ChannelConfig_read(ser_ref);
21511 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21512 return (uint64_t)ret_conv;
21515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21516 LDKUserConfig this_obj_conv;
21517 this_obj_conv.inner = (void*)(this_obj & (~1));
21518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21520 UserConfig_free(this_obj_conv);
21523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
21524 LDKUserConfig this_ptr_conv;
21525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21526 this_ptr_conv.is_owned = false;
21527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21528 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
21529 uint64_t ret_ref = 0;
21530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21533 ret_ref = (uint64_t)ret_var.inner;
21534 if (ret_var.is_owned) {
21540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21541 LDKUserConfig this_ptr_conv;
21542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21543 this_ptr_conv.is_owned = false;
21544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21545 LDKChannelHandshakeConfig val_conv;
21546 val_conv.inner = (void*)(val & (~1));
21547 val_conv.is_owned = (val & 1) || (val == 0);
21548 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21549 val_conv = ChannelHandshakeConfig_clone(&val_conv);
21550 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
21553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
21554 LDKUserConfig this_ptr_conv;
21555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21556 this_ptr_conv.is_owned = false;
21557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21558 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
21559 uint64_t ret_ref = 0;
21560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21563 ret_ref = (uint64_t)ret_var.inner;
21564 if (ret_var.is_owned) {
21570 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) {
21571 LDKUserConfig this_ptr_conv;
21572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21573 this_ptr_conv.is_owned = false;
21574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21575 LDKChannelHandshakeLimits val_conv;
21576 val_conv.inner = (void*)(val & (~1));
21577 val_conv.is_owned = (val & 1) || (val == 0);
21578 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21579 val_conv = ChannelHandshakeLimits_clone(&val_conv);
21580 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
21583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
21584 LDKUserConfig this_ptr_conv;
21585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21586 this_ptr_conv.is_owned = false;
21587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21588 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
21589 uint64_t ret_ref = 0;
21590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21593 ret_ref = (uint64_t)ret_var.inner;
21594 if (ret_var.is_owned) {
21600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21601 LDKUserConfig this_ptr_conv;
21602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21603 this_ptr_conv.is_owned = false;
21604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21605 LDKChannelConfig val_conv;
21606 val_conv.inner = (void*)(val & (~1));
21607 val_conv.is_owned = (val & 1) || (val == 0);
21608 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21609 val_conv = ChannelConfig_clone(&val_conv);
21610 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
21613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
21614 LDKUserConfig this_ptr_conv;
21615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21616 this_ptr_conv.is_owned = false;
21617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21618 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21623 LDKUserConfig this_ptr_conv;
21624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21625 this_ptr_conv.is_owned = false;
21626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21627 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
21631 LDKUserConfig this_ptr_conv;
21632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21633 this_ptr_conv.is_owned = false;
21634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21635 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21640 LDKUserConfig this_ptr_conv;
21641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21642 this_ptr_conv.is_owned = false;
21643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21644 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) {
21648 LDKChannelHandshakeConfig own_channel_config_arg_conv;
21649 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
21650 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
21651 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
21652 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
21653 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
21654 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
21655 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
21656 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
21657 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
21658 LDKChannelConfig channel_options_arg_conv;
21659 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
21660 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
21661 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
21662 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
21663 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg);
21664 uint64_t ret_ref = 0;
21665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21668 ret_ref = (uint64_t)ret_var.inner;
21669 if (ret_var.is_owned) {
21675 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21676 LDKUserConfig ret_var = UserConfig_clone(arg);
21677 uint64_t ret_ref = 0;
21678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21681 ret_ref = (uint64_t)ret_var.inner;
21682 if (ret_var.is_owned) {
21687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21688 LDKUserConfig arg_conv;
21689 arg_conv.inner = (void*)(arg & (~1));
21690 arg_conv.is_owned = false;
21691 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21692 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
21696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21697 LDKUserConfig orig_conv;
21698 orig_conv.inner = (void*)(orig & (~1));
21699 orig_conv.is_owned = false;
21700 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21701 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
21702 uint64_t ret_ref = 0;
21703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21706 ret_ref = (uint64_t)ret_var.inner;
21707 if (ret_var.is_owned) {
21713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
21714 LDKUserConfig ret_var = UserConfig_default();
21715 uint64_t ret_ref = 0;
21716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21719 ret_ref = (uint64_t)ret_var.inner;
21720 if (ret_var.is_owned) {
21726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21727 LDKBestBlock this_obj_conv;
21728 this_obj_conv.inner = (void*)(this_obj & (~1));
21729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21731 BestBlock_free(this_obj_conv);
21734 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
21735 LDKBestBlock ret_var = BestBlock_clone(arg);
21736 uint64_t ret_ref = 0;
21737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21740 ret_ref = (uint64_t)ret_var.inner;
21741 if (ret_var.is_owned) {
21746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21747 LDKBestBlock arg_conv;
21748 arg_conv.inner = (void*)(arg & (~1));
21749 arg_conv.is_owned = false;
21750 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21751 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
21755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21756 LDKBestBlock orig_conv;
21757 orig_conv.inner = (void*)(orig & (~1));
21758 orig_conv.is_owned = false;
21759 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21760 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21761 uint64_t ret_ref = 0;
21762 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21763 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21765 ret_ref = (uint64_t)ret_var.inner;
21766 if (ret_var.is_owned) {
21772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
21773 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
21774 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
21775 uint64_t ret_ref = 0;
21776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21779 ret_ref = (uint64_t)ret_var.inner;
21780 if (ret_var.is_owned) {
21786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
21787 LDKThirtyTwoBytes block_hash_ref;
21788 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
21789 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
21790 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
21791 uint64_t ret_ref = 0;
21792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21795 ret_ref = (uint64_t)ret_var.inner;
21796 if (ret_var.is_owned) {
21802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
21803 LDKBestBlock this_arg_conv;
21804 this_arg_conv.inner = (void*)(this_arg & (~1));
21805 this_arg_conv.is_owned = false;
21806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21807 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21808 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
21812 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
21813 LDKBestBlock this_arg_conv;
21814 this_arg_conv.inner = (void*)(this_arg & (~1));
21815 this_arg_conv.is_owned = false;
21816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21817 int32_t ret_val = BestBlock_height(&this_arg_conv);
21821 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21822 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
21823 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
21827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
21828 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
21832 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
21833 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
21837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21838 if ((this_ptr & 1) != 0) return;
21839 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21840 CHECK_ACCESS(this_ptr_ptr);
21841 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
21842 FREE((void*)this_ptr);
21843 Access_free(this_ptr_conv);
21846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21847 if ((this_ptr & 1) != 0) return;
21848 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21849 CHECK_ACCESS(this_ptr_ptr);
21850 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
21851 FREE((void*)this_ptr);
21852 Listen_free(this_ptr_conv);
21855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21856 if ((this_ptr & 1) != 0) return;
21857 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21858 CHECK_ACCESS(this_ptr_ptr);
21859 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
21860 FREE((void*)this_ptr);
21861 Confirm_free(this_ptr_conv);
21864 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21865 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
21866 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
21870 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
21871 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
21875 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
21876 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
21880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21881 if ((this_ptr & 1) != 0) return;
21882 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21883 CHECK_ACCESS(this_ptr_ptr);
21884 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
21885 FREE((void*)this_ptr);
21886 Watch_free(this_ptr_conv);
21889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21890 if ((this_ptr & 1) != 0) return;
21891 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21892 CHECK_ACCESS(this_ptr_ptr);
21893 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
21894 FREE((void*)this_ptr);
21895 Filter_free(this_ptr_conv);
21898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21899 LDKWatchedOutput this_obj_conv;
21900 this_obj_conv.inner = (void*)(this_obj & (~1));
21901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21903 WatchedOutput_free(this_obj_conv);
21906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21907 LDKWatchedOutput this_ptr_conv;
21908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21909 this_ptr_conv.is_owned = false;
21910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21911 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
21916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21917 LDKWatchedOutput this_ptr_conv;
21918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21919 this_ptr_conv.is_owned = false;
21920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21921 LDKThirtyTwoBytes val_ref;
21922 CHECK((*env)->GetArrayLength(env, val) == 32);
21923 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21924 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
21927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21928 LDKWatchedOutput this_ptr_conv;
21929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21930 this_ptr_conv.is_owned = false;
21931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21932 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
21933 uint64_t ret_ref = 0;
21934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21937 ret_ref = (uint64_t)ret_var.inner;
21938 if (ret_var.is_owned) {
21944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21945 LDKWatchedOutput this_ptr_conv;
21946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21947 this_ptr_conv.is_owned = false;
21948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21949 LDKOutPoint val_conv;
21950 val_conv.inner = (void*)(val & (~1));
21951 val_conv.is_owned = (val & 1) || (val == 0);
21952 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21953 val_conv = OutPoint_clone(&val_conv);
21954 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
21957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21958 LDKWatchedOutput this_ptr_conv;
21959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21960 this_ptr_conv.is_owned = false;
21961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21962 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
21963 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21964 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21969 LDKWatchedOutput this_ptr_conv;
21970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21971 this_ptr_conv.is_owned = false;
21972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21973 LDKCVec_u8Z val_ref;
21974 val_ref.datalen = (*env)->GetArrayLength(env, val);
21975 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21976 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
21977 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
21980 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) {
21981 LDKThirtyTwoBytes block_hash_arg_ref;
21982 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
21983 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
21984 LDKOutPoint outpoint_arg_conv;
21985 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
21986 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
21987 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
21988 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
21989 LDKCVec_u8Z script_pubkey_arg_ref;
21990 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
21991 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21992 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
21993 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
21994 uint64_t ret_ref = 0;
21995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21998 ret_ref = (uint64_t)ret_var.inner;
21999 if (ret_var.is_owned) {
22005 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
22006 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
22007 uint64_t ret_ref = 0;
22008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22011 ret_ref = (uint64_t)ret_var.inner;
22012 if (ret_var.is_owned) {
22017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22018 LDKWatchedOutput arg_conv;
22019 arg_conv.inner = (void*)(arg & (~1));
22020 arg_conv.is_owned = false;
22021 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22022 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
22026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22027 LDKWatchedOutput orig_conv;
22028 orig_conv.inner = (void*)(orig & (~1));
22029 orig_conv.is_owned = false;
22030 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22031 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
22032 uint64_t ret_ref = 0;
22033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22036 ret_ref = (uint64_t)ret_var.inner;
22037 if (ret_var.is_owned) {
22043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
22044 LDKWatchedOutput o_conv;
22045 o_conv.inner = (void*)(o & (~1));
22046 o_conv.is_owned = false;
22047 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22048 int64_t ret_val = WatchedOutput_hash(&o_conv);
22052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22053 if ((this_ptr & 1) != 0) return;
22054 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22055 CHECK_ACCESS(this_ptr_ptr);
22056 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
22057 FREE((void*)this_ptr);
22058 BroadcasterInterface_free(this_ptr_conv);
22061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22062 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
22063 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
22067 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
22068 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
22072 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
22073 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
22077 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
22078 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
22082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22083 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
22084 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
22085 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
22089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22090 if ((this_ptr & 1) != 0) return;
22091 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22092 CHECK_ACCESS(this_ptr_ptr);
22093 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
22094 FREE((void*)this_ptr);
22095 FeeEstimator_free(this_ptr_conv);
22098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22099 LDKMonitorUpdateId this_obj_conv;
22100 this_obj_conv.inner = (void*)(this_obj & (~1));
22101 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22103 MonitorUpdateId_free(this_obj_conv);
22106 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
22107 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
22108 uint64_t ret_ref = 0;
22109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22112 ret_ref = (uint64_t)ret_var.inner;
22113 if (ret_var.is_owned) {
22118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22119 LDKMonitorUpdateId arg_conv;
22120 arg_conv.inner = (void*)(arg & (~1));
22121 arg_conv.is_owned = false;
22122 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22123 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
22127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22128 LDKMonitorUpdateId orig_conv;
22129 orig_conv.inner = (void*)(orig & (~1));
22130 orig_conv.is_owned = false;
22131 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22132 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
22133 uint64_t ret_ref = 0;
22134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22137 ret_ref = (uint64_t)ret_var.inner;
22138 if (ret_var.is_owned) {
22144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
22145 LDKMonitorUpdateId o_conv;
22146 o_conv.inner = (void*)(o & (~1));
22147 o_conv.is_owned = false;
22148 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22149 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
22153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22154 LDKMonitorUpdateId a_conv;
22155 a_conv.inner = (void*)(a & (~1));
22156 a_conv.is_owned = false;
22157 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22158 LDKMonitorUpdateId b_conv;
22159 b_conv.inner = (void*)(b & (~1));
22160 b_conv.is_owned = false;
22161 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22162 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
22166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22167 if ((this_ptr & 1) != 0) return;
22168 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22169 CHECK_ACCESS(this_ptr_ptr);
22170 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22171 FREE((void*)this_ptr);
22172 Persist_free(this_ptr_conv);
22175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22176 LDKLockedChannelMonitor this_obj_conv;
22177 this_obj_conv.inner = (void*)(this_obj & (~1));
22178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22180 LockedChannelMonitor_free(this_obj_conv);
22183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22184 LDKChainMonitor this_obj_conv;
22185 this_obj_conv.inner = (void*)(this_obj & (~1));
22186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22188 ChainMonitor_free(this_obj_conv);
22191 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) {
22192 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
22193 CHECK_ACCESS(chain_source_ptr);
22194 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22195 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
22196 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22197 // Manually implement clone for Java trait instances
22198 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22199 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22200 LDKFilter_JCalls_cloned(&chain_source_conv.some);
22203 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
22204 CHECK_ACCESS(broadcaster_ptr);
22205 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22206 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22208 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22210 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22211 CHECK_ACCESS(logger_ptr);
22212 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22213 if (logger_conv.free == LDKLogger_JCalls_free) {
22214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22215 LDKLogger_JCalls_cloned(&logger_conv);
22217 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
22218 CHECK_ACCESS(feeest_ptr);
22219 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22220 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22221 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22222 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22224 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
22225 CHECK_ACCESS(persister_ptr);
22226 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22227 if (persister_conv.free == LDKPersist_JCalls_free) {
22228 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22229 LDKPersist_JCalls_cloned(&persister_conv);
22231 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22232 uint64_t ret_ref = 0;
22233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22236 ret_ref = (uint64_t)ret_var.inner;
22237 if (ret_var.is_owned) {
22243 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
22244 LDKChainMonitor this_arg_conv;
22245 this_arg_conv.inner = (void*)(this_arg & (~1));
22246 this_arg_conv.is_owned = false;
22247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22248 LDKCVec_ChannelDetailsZ ignored_channels_constr;
22249 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
22250 if (ignored_channels_constr.datalen > 0)
22251 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22253 ignored_channels_constr.data = NULL;
22254 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
22255 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22256 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
22257 LDKChannelDetails ignored_channels_conv_16_conv;
22258 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
22259 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
22260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22261 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22262 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22264 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
22265 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22266 int64_tArray ret_arr = NULL;
22267 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22268 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22269 for (size_t j = 0; j < ret_var.datalen; j++) {
22270 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22271 *ret_conv_9_copy = ret_var.data[j];
22272 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
22273 ret_arr_ptr[j] = ret_conv_9_ref;
22275 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22276 FREE(ret_var.data);
22280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
22281 LDKChainMonitor this_arg_conv;
22282 this_arg_conv.inner = (void*)(this_arg & (~1));
22283 this_arg_conv.is_owned = false;
22284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22285 LDKOutPoint funding_txo_conv;
22286 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22287 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22288 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22289 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22290 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22291 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22292 return (uint64_t)ret_conv;
22295 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
22296 LDKChainMonitor this_arg_conv;
22297 this_arg_conv.inner = (void*)(this_arg & (~1));
22298 this_arg_conv.is_owned = false;
22299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22300 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22301 int64_tArray ret_arr = NULL;
22302 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22303 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22304 for (size_t k = 0; k < ret_var.datalen; k++) {
22305 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22306 uint64_t ret_conv_10_ref = 0;
22307 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22308 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22310 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
22311 if (ret_conv_10_var.is_owned) {
22312 ret_conv_10_ref |= 1;
22314 ret_arr_ptr[k] = ret_conv_10_ref;
22316 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22317 FREE(ret_var.data);
22321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
22322 LDKChainMonitor this_arg_conv;
22323 this_arg_conv.inner = (void*)(this_arg & (~1));
22324 this_arg_conv.is_owned = false;
22325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22326 LDKOutPoint funding_txo_conv;
22327 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22328 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22329 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22330 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22331 LDKMonitorUpdateId completed_update_id_conv;
22332 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
22333 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
22334 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22335 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22336 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22337 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22338 return (uint64_t)ret_conv;
22341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
22342 LDKChainMonitor this_arg_conv;
22343 this_arg_conv.inner = (void*)(this_arg & (~1));
22344 this_arg_conv.is_owned = false;
22345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22346 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22347 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22348 return (uint64_t)ret_ret;
22351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
22352 LDKChainMonitor this_arg_conv;
22353 this_arg_conv.inner = (void*)(this_arg & (~1));
22354 this_arg_conv.is_owned = false;
22355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22356 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22357 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22358 return (uint64_t)ret_ret;
22361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
22362 LDKChainMonitor this_arg_conv;
22363 this_arg_conv.inner = (void*)(this_arg & (~1));
22364 this_arg_conv.is_owned = false;
22365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22366 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22367 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22368 return (uint64_t)ret_ret;
22371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
22372 LDKChainMonitor this_arg_conv;
22373 this_arg_conv.inner = (void*)(this_arg & (~1));
22374 this_arg_conv.is_owned = false;
22375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22376 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22377 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22378 return (uint64_t)ret_ret;
22381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22382 LDKChannelMonitorUpdate this_obj_conv;
22383 this_obj_conv.inner = (void*)(this_obj & (~1));
22384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22386 ChannelMonitorUpdate_free(this_obj_conv);
22389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22390 LDKChannelMonitorUpdate this_ptr_conv;
22391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22392 this_ptr_conv.is_owned = false;
22393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22394 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22399 LDKChannelMonitorUpdate this_ptr_conv;
22400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22401 this_ptr_conv.is_owned = false;
22402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22403 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22406 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22407 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22408 uint64_t ret_ref = 0;
22409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22412 ret_ref = (uint64_t)ret_var.inner;
22413 if (ret_var.is_owned) {
22418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22419 LDKChannelMonitorUpdate arg_conv;
22420 arg_conv.inner = (void*)(arg & (~1));
22421 arg_conv.is_owned = false;
22422 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22423 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22428 LDKChannelMonitorUpdate orig_conv;
22429 orig_conv.inner = (void*)(orig & (~1));
22430 orig_conv.is_owned = false;
22431 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22432 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22433 uint64_t ret_ref = 0;
22434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22437 ret_ref = (uint64_t)ret_var.inner;
22438 if (ret_var.is_owned) {
22444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22445 LDKChannelMonitorUpdate obj_conv;
22446 obj_conv.inner = (void*)(obj & (~1));
22447 obj_conv.is_owned = false;
22448 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22449 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22450 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22451 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22452 CVec_u8Z_free(ret_var);
22456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22457 LDKu8slice ser_ref;
22458 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22459 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22460 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22461 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22462 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22463 return (uint64_t)ret_conv;
22466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22467 if ((this_ptr & 1) != 0) return;
22468 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22469 CHECK_ACCESS(this_ptr_ptr);
22470 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22471 FREE((void*)this_ptr);
22472 MonitorEvent_free(this_ptr_conv);
22475 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22476 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22477 *ret_copy = MonitorEvent_clone(arg);
22478 uint64_t ret_ref = (uint64_t)ret_copy;
22481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22482 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
22483 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
22487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22488 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
22489 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22490 *ret_copy = MonitorEvent_clone(orig_conv);
22491 uint64_t ret_ref = (uint64_t)ret_copy;
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
22496 LDKHTLCUpdate a_conv;
22497 a_conv.inner = (void*)(a & (~1));
22498 a_conv.is_owned = (a & 1) || (a == 0);
22499 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22500 a_conv = HTLCUpdate_clone(&a_conv);
22501 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22502 *ret_copy = MonitorEvent_htlcevent(a_conv);
22503 uint64_t ret_ref = (uint64_t)ret_copy;
22507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
22508 LDKOutPoint a_conv;
22509 a_conv.inner = (void*)(a & (~1));
22510 a_conv.is_owned = (a & 1) || (a == 0);
22511 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22512 a_conv = OutPoint_clone(&a_conv);
22513 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22514 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22515 uint64_t ret_ref = (uint64_t)ret_copy;
22519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
22520 LDKOutPoint funding_txo_conv;
22521 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22522 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22523 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22524 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22525 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22526 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22527 uint64_t ret_ref = (uint64_t)ret_copy;
22531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
22532 LDKOutPoint a_conv;
22533 a_conv.inner = (void*)(a & (~1));
22534 a_conv.is_owned = (a & 1) || (a == 0);
22535 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22536 a_conv = OutPoint_clone(&a_conv);
22537 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22538 *ret_copy = MonitorEvent_update_failed(a_conv);
22539 uint64_t ret_ref = (uint64_t)ret_copy;
22543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
22544 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
22545 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22546 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22547 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22548 CVec_u8Z_free(ret_var);
22552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22553 LDKu8slice ser_ref;
22554 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22555 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22556 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22557 *ret_conv = MonitorEvent_read(ser_ref);
22558 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22559 return (uint64_t)ret_conv;
22562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22563 LDKHTLCUpdate this_obj_conv;
22564 this_obj_conv.inner = (void*)(this_obj & (~1));
22565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22567 HTLCUpdate_free(this_obj_conv);
22570 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22571 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22572 uint64_t ret_ref = 0;
22573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22576 ret_ref = (uint64_t)ret_var.inner;
22577 if (ret_var.is_owned) {
22582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22583 LDKHTLCUpdate arg_conv;
22584 arg_conv.inner = (void*)(arg & (~1));
22585 arg_conv.is_owned = false;
22586 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22587 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
22591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22592 LDKHTLCUpdate orig_conv;
22593 orig_conv.inner = (void*)(orig & (~1));
22594 orig_conv.is_owned = false;
22595 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22596 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22597 uint64_t ret_ref = 0;
22598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22601 ret_ref = (uint64_t)ret_var.inner;
22602 if (ret_var.is_owned) {
22608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22609 LDKHTLCUpdate obj_conv;
22610 obj_conv.inner = (void*)(obj & (~1));
22611 obj_conv.is_owned = false;
22612 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22613 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22614 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22615 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22616 CVec_u8Z_free(ret_var);
22620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22621 LDKu8slice ser_ref;
22622 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22623 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22624 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22625 *ret_conv = HTLCUpdate_read(ser_ref);
22626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22627 return (uint64_t)ret_conv;
22630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22631 if ((this_ptr & 1) != 0) return;
22632 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22633 CHECK_ACCESS(this_ptr_ptr);
22634 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22635 FREE((void*)this_ptr);
22636 Balance_free(this_ptr_conv);
22639 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22640 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22641 *ret_copy = Balance_clone(arg);
22642 uint64_t ret_ref = (uint64_t)ret_copy;
22645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22646 LDKBalance* arg_conv = (LDKBalance*)arg;
22647 int64_t ret_val = Balance_clone_ptr(arg_conv);
22651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22652 LDKBalance* orig_conv = (LDKBalance*)orig;
22653 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22654 *ret_copy = Balance_clone(orig_conv);
22655 uint64_t ret_ref = (uint64_t)ret_copy;
22659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
22660 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22661 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22662 uint64_t ret_ref = (uint64_t)ret_copy;
22666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22667 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22668 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22669 uint64_t ret_ref = (uint64_t)ret_copy;
22673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
22674 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22675 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22676 uint64_t ret_ref = (uint64_t)ret_copy;
22680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
22681 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22682 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22683 uint64_t ret_ref = (uint64_t)ret_copy;
22687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22688 LDKBalance* a_conv = (LDKBalance*)a;
22689 LDKBalance* b_conv = (LDKBalance*)b;
22690 jboolean ret_val = Balance_eq(a_conv, b_conv);
22694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22695 LDKChannelMonitor this_obj_conv;
22696 this_obj_conv.inner = (void*)(this_obj & (~1));
22697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22699 ChannelMonitor_free(this_obj_conv);
22702 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
22703 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
22704 uint64_t ret_ref = 0;
22705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22708 ret_ref = (uint64_t)ret_var.inner;
22709 if (ret_var.is_owned) {
22714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22715 LDKChannelMonitor arg_conv;
22716 arg_conv.inner = (void*)(arg & (~1));
22717 arg_conv.is_owned = false;
22718 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22719 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
22723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22724 LDKChannelMonitor orig_conv;
22725 orig_conv.inner = (void*)(orig & (~1));
22726 orig_conv.is_owned = false;
22727 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22728 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
22729 uint64_t ret_ref = 0;
22730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22733 ret_ref = (uint64_t)ret_var.inner;
22734 if (ret_var.is_owned) {
22740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
22741 LDKChannelMonitor obj_conv;
22742 obj_conv.inner = (void*)(obj & (~1));
22743 obj_conv.is_owned = false;
22744 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22745 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
22746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22748 CVec_u8Z_free(ret_var);
22752 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) {
22753 LDKChannelMonitor this_arg_conv;
22754 this_arg_conv.inner = (void*)(this_arg & (~1));
22755 this_arg_conv.is_owned = false;
22756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22757 LDKChannelMonitorUpdate updates_conv;
22758 updates_conv.inner = (void*)(updates & (~1));
22759 updates_conv.is_owned = false;
22760 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22761 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
22762 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
22763 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22764 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22765 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
22766 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
22767 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22768 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22769 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22770 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22771 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
22772 return (uint64_t)ret_conv;
22775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
22776 LDKChannelMonitor this_arg_conv;
22777 this_arg_conv.inner = (void*)(this_arg & (~1));
22778 this_arg_conv.is_owned = false;
22779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22780 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
22784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
22785 LDKChannelMonitor this_arg_conv;
22786 this_arg_conv.inner = (void*)(this_arg & (~1));
22787 this_arg_conv.is_owned = false;
22788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22789 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22790 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
22791 return ((uint64_t)ret_conv);
22794 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
22795 LDKChannelMonitor this_arg_conv;
22796 this_arg_conv.inner = (void*)(this_arg & (~1));
22797 this_arg_conv.is_owned = false;
22798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22799 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
22800 int64_tArray ret_arr = NULL;
22801 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22802 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22803 for (size_t o = 0; o < ret_var.datalen; o++) {
22804 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22805 *ret_conv_40_conv = ret_var.data[o];
22806 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
22808 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22809 FREE(ret_var.data);
22813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
22814 LDKChannelMonitor this_arg_conv;
22815 this_arg_conv.inner = (void*)(this_arg & (~1));
22816 this_arg_conv.is_owned = false;
22817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22818 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
22819 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
22820 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
22821 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
22824 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
22825 LDKChannelMonitor this_arg_conv;
22826 this_arg_conv.inner = (void*)(this_arg & (~1));
22827 this_arg_conv.is_owned = false;
22828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22829 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
22830 int64_tArray ret_arr = NULL;
22831 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22832 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22833 for (size_t o = 0; o < ret_var.datalen; o++) {
22834 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22835 *ret_conv_14_copy = ret_var.data[o];
22836 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
22837 ret_arr_ptr[o] = ret_conv_14_ref;
22839 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22840 FREE(ret_var.data);
22844 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
22845 LDKChannelMonitor this_arg_conv;
22846 this_arg_conv.inner = (void*)(this_arg & (~1));
22847 this_arg_conv.is_owned = false;
22848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22849 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
22850 int64_tArray ret_arr = NULL;
22851 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22852 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22853 for (size_t h = 0; h < ret_var.datalen; h++) {
22854 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22855 *ret_conv_7_copy = ret_var.data[h];
22856 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
22857 ret_arr_ptr[h] = ret_conv_7_ref;
22859 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22860 FREE(ret_var.data);
22864 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) {
22865 LDKChannelMonitor this_arg_conv;
22866 this_arg_conv.inner = (void*)(this_arg & (~1));
22867 this_arg_conv.is_owned = false;
22868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22869 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22870 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22871 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22872 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
22873 jobjectArray ret_arr = NULL;
22874 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
22876 for (size_t i = 0; i < ret_var.datalen; i++) {
22877 LDKTransaction ret_conv_8_var = ret_var.data[i];
22878 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
22879 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
22880 Transaction_free(ret_conv_8_var);
22881 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
22884 FREE(ret_var.data);
22888 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) {
22889 LDKChannelMonitor this_arg_conv;
22890 this_arg_conv.inner = (void*)(this_arg & (~1));
22891 this_arg_conv.is_owned = false;
22892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22893 unsigned char header_arr[80];
22894 CHECK((*env)->GetArrayLength(env, header) == 80);
22895 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
22896 unsigned char (*header_ref)[80] = &header_arr;
22897 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22898 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
22899 if (txdata_constr.datalen > 0)
22900 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22902 txdata_constr.data = NULL;
22903 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
22904 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22905 int64_t txdata_conv_28 = txdata_vals[c];
22906 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
22907 CHECK_ACCESS(txdata_conv_28_ptr);
22908 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22909 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
22910 txdata_constr.data[c] = txdata_conv_28_conv;
22912 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
22913 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
22914 CHECK_ACCESS(broadcaster_ptr);
22915 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22916 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22917 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22918 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22920 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22921 CHECK_ACCESS(fee_estimator_ptr);
22922 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22923 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22924 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22925 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22927 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22928 CHECK_ACCESS(logger_ptr);
22929 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22930 if (logger_conv.free == LDKLogger_JCalls_free) {
22931 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22932 LDKLogger_JCalls_cloned(&logger_conv);
22934 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);
22935 int64_tArray ret_arr = NULL;
22936 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22937 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22938 for (size_t n = 0; n < ret_var.datalen; n++) {
22939 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22940 *ret_conv_39_conv = ret_var.data[n];
22941 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
22943 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22944 FREE(ret_var.data);
22948 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) {
22949 LDKChannelMonitor this_arg_conv;
22950 this_arg_conv.inner = (void*)(this_arg & (~1));
22951 this_arg_conv.is_owned = false;
22952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22953 unsigned char header_arr[80];
22954 CHECK((*env)->GetArrayLength(env, header) == 80);
22955 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
22956 unsigned char (*header_ref)[80] = &header_arr;
22957 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
22958 CHECK_ACCESS(broadcaster_ptr);
22959 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22960 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22961 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22962 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22964 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22965 CHECK_ACCESS(fee_estimator_ptr);
22966 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22967 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22969 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22971 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22972 CHECK_ACCESS(logger_ptr);
22973 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22974 if (logger_conv.free == LDKLogger_JCalls_free) {
22975 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22976 LDKLogger_JCalls_cloned(&logger_conv);
22978 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22981 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) {
22982 LDKChannelMonitor this_arg_conv;
22983 this_arg_conv.inner = (void*)(this_arg & (~1));
22984 this_arg_conv.is_owned = false;
22985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22986 unsigned char header_arr[80];
22987 CHECK((*env)->GetArrayLength(env, header) == 80);
22988 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
22989 unsigned char (*header_ref)[80] = &header_arr;
22990 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22991 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
22992 if (txdata_constr.datalen > 0)
22993 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22995 txdata_constr.data = NULL;
22996 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
22997 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22998 int64_t txdata_conv_28 = txdata_vals[c];
22999 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
23000 CHECK_ACCESS(txdata_conv_28_ptr);
23001 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23002 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
23003 txdata_constr.data[c] = txdata_conv_28_conv;
23005 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
23006 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
23007 CHECK_ACCESS(broadcaster_ptr);
23008 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23009 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23010 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23011 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23013 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
23014 CHECK_ACCESS(fee_estimator_ptr);
23015 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23016 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23017 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23018 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23020 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
23021 CHECK_ACCESS(logger_ptr);
23022 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23023 if (logger_conv.free == LDKLogger_JCalls_free) {
23024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23025 LDKLogger_JCalls_cloned(&logger_conv);
23027 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);
23028 int64_tArray ret_arr = NULL;
23029 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23030 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23031 for (size_t n = 0; n < ret_var.datalen; n++) {
23032 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23033 *ret_conv_39_conv = ret_var.data[n];
23034 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
23036 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23037 FREE(ret_var.data);
23041 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) {
23042 LDKChannelMonitor this_arg_conv;
23043 this_arg_conv.inner = (void*)(this_arg & (~1));
23044 this_arg_conv.is_owned = false;
23045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23046 unsigned char txid_arr[32];
23047 CHECK((*env)->GetArrayLength(env, txid) == 32);
23048 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
23049 unsigned char (*txid_ref)[32] = &txid_arr;
23050 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
23051 CHECK_ACCESS(broadcaster_ptr);
23052 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23053 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23054 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23055 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23057 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
23058 CHECK_ACCESS(fee_estimator_ptr);
23059 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23060 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23062 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23064 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
23065 CHECK_ACCESS(logger_ptr);
23066 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23067 if (logger_conv.free == LDKLogger_JCalls_free) {
23068 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23069 LDKLogger_JCalls_cloned(&logger_conv);
23071 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
23074 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) {
23075 LDKChannelMonitor this_arg_conv;
23076 this_arg_conv.inner = (void*)(this_arg & (~1));
23077 this_arg_conv.is_owned = false;
23078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23079 unsigned char header_arr[80];
23080 CHECK((*env)->GetArrayLength(env, header) == 80);
23081 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
23082 unsigned char (*header_ref)[80] = &header_arr;
23083 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
23084 CHECK_ACCESS(broadcaster_ptr);
23085 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23086 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23087 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23088 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23090 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
23091 CHECK_ACCESS(fee_estimator_ptr);
23092 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23093 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23094 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23095 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23097 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
23098 CHECK_ACCESS(logger_ptr);
23099 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23100 if (logger_conv.free == LDKLogger_JCalls_free) {
23101 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23102 LDKLogger_JCalls_cloned(&logger_conv);
23104 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23105 int64_tArray ret_arr = NULL;
23106 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23107 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23108 for (size_t n = 0; n < ret_var.datalen; n++) {
23109 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23110 *ret_conv_39_conv = ret_var.data[n];
23111 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
23113 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23114 FREE(ret_var.data);
23118 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
23119 LDKChannelMonitor this_arg_conv;
23120 this_arg_conv.inner = (void*)(this_arg & (~1));
23121 this_arg_conv.is_owned = false;
23122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23123 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
23124 jobjectArray ret_arr = NULL;
23125 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
23127 for (size_t i = 0; i < ret_var.datalen; i++) {
23128 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
23129 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
23130 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
23133 FREE(ret_var.data);
23137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
23138 LDKChannelMonitor this_arg_conv;
23139 this_arg_conv.inner = (void*)(this_arg & (~1));
23140 this_arg_conv.is_owned = false;
23141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23142 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
23143 uint64_t ret_ref = 0;
23144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23147 ret_ref = (uint64_t)ret_var.inner;
23148 if (ret_var.is_owned) {
23154 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
23155 LDKChannelMonitor this_arg_conv;
23156 this_arg_conv.inner = (void*)(this_arg & (~1));
23157 this_arg_conv.is_owned = false;
23158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23159 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23160 int64_tArray ret_arr = NULL;
23161 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23162 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23163 for (size_t j = 0; j < ret_var.datalen; j++) {
23164 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23165 *ret_conv_9_copy = ret_var.data[j];
23166 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
23167 ret_arr_ptr[j] = ret_conv_9_ref;
23169 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23170 FREE(ret_var.data);
23174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
23175 LDKu8slice ser_ref;
23176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23178 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
23179 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23180 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23181 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23182 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23183 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23184 return (uint64_t)ret_conv;
23187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23188 LDKOutPoint this_obj_conv;
23189 this_obj_conv.inner = (void*)(this_obj & (~1));
23190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23192 OutPoint_free(this_obj_conv);
23195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
23196 LDKOutPoint this_ptr_conv;
23197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23198 this_ptr_conv.is_owned = false;
23199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23200 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
23205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23206 LDKOutPoint this_ptr_conv;
23207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23208 this_ptr_conv.is_owned = false;
23209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23210 LDKThirtyTwoBytes val_ref;
23211 CHECK((*env)->GetArrayLength(env, val) == 32);
23212 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23213 OutPoint_set_txid(&this_ptr_conv, val_ref);
23216 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
23217 LDKOutPoint this_ptr_conv;
23218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23219 this_ptr_conv.is_owned = false;
23220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23221 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
23225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23226 LDKOutPoint this_ptr_conv;
23227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23228 this_ptr_conv.is_owned = false;
23229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23230 OutPoint_set_index(&this_ptr_conv, val);
23233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
23234 LDKThirtyTwoBytes txid_arg_ref;
23235 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
23236 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
23237 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23238 uint64_t ret_ref = 0;
23239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23242 ret_ref = (uint64_t)ret_var.inner;
23243 if (ret_var.is_owned) {
23249 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23250 LDKOutPoint ret_var = OutPoint_clone(arg);
23251 uint64_t ret_ref = 0;
23252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23255 ret_ref = (uint64_t)ret_var.inner;
23256 if (ret_var.is_owned) {
23261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23262 LDKOutPoint arg_conv;
23263 arg_conv.inner = (void*)(arg & (~1));
23264 arg_conv.is_owned = false;
23265 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23266 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
23270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23271 LDKOutPoint orig_conv;
23272 orig_conv.inner = (void*)(orig & (~1));
23273 orig_conv.is_owned = false;
23274 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23275 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23276 uint64_t ret_ref = 0;
23277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23280 ret_ref = (uint64_t)ret_var.inner;
23281 if (ret_var.is_owned) {
23287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23288 LDKOutPoint a_conv;
23289 a_conv.inner = (void*)(a & (~1));
23290 a_conv.is_owned = false;
23291 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23292 LDKOutPoint b_conv;
23293 b_conv.inner = (void*)(b & (~1));
23294 b_conv.is_owned = false;
23295 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23296 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
23300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
23301 LDKOutPoint o_conv;
23302 o_conv.inner = (void*)(o & (~1));
23303 o_conv.is_owned = false;
23304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23305 int64_t ret_val = OutPoint_hash(&o_conv);
23309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
23310 LDKOutPoint this_arg_conv;
23311 this_arg_conv.inner = (void*)(this_arg & (~1));
23312 this_arg_conv.is_owned = false;
23313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23314 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23315 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
23319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
23320 LDKOutPoint obj_conv;
23321 obj_conv.inner = (void*)(obj & (~1));
23322 obj_conv.is_owned = false;
23323 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23324 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23325 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23326 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23327 CVec_u8Z_free(ret_var);
23331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23332 LDKu8slice ser_ref;
23333 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23334 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23335 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23336 *ret_conv = OutPoint_read(ser_ref);
23337 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23338 return (uint64_t)ret_conv;
23341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23342 LDKDelayedPaymentOutputDescriptor this_obj_conv;
23343 this_obj_conv.inner = (void*)(this_obj & (~1));
23344 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23346 DelayedPaymentOutputDescriptor_free(this_obj_conv);
23349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
23350 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23352 this_ptr_conv.is_owned = false;
23353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23354 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23355 uint64_t ret_ref = 0;
23356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23359 ret_ref = (uint64_t)ret_var.inner;
23360 if (ret_var.is_owned) {
23366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23367 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23369 this_ptr_conv.is_owned = false;
23370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23371 LDKOutPoint val_conv;
23372 val_conv.inner = (void*)(val & (~1));
23373 val_conv.is_owned = (val & 1) || (val == 0);
23374 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23375 val_conv = OutPoint_clone(&val_conv);
23376 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
23380 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23382 this_ptr_conv.is_owned = false;
23383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23384 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23385 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
23389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23390 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23392 this_ptr_conv.is_owned = false;
23393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23394 LDKPublicKey val_ref;
23395 CHECK((*env)->GetArrayLength(env, val) == 33);
23396 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23397 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23401 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23403 this_ptr_conv.is_owned = false;
23404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23405 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23410 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23412 this_ptr_conv.is_owned = false;
23413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23414 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23418 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23420 this_ptr_conv.is_owned = false;
23421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23422 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23423 CHECK_ACCESS(val_ptr);
23424 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23425 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
23426 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
23430 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23432 this_ptr_conv.is_owned = false;
23433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23434 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
23439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23440 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23442 this_ptr_conv.is_owned = false;
23443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23444 LDKPublicKey val_ref;
23445 CHECK((*env)->GetArrayLength(env, val) == 33);
23446 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23447 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23451 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23453 this_ptr_conv.is_owned = false;
23454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23455 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23456 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
23460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23461 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23463 this_ptr_conv.is_owned = false;
23464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23465 LDKThirtyTwoBytes val_ref;
23466 CHECK((*env)->GetArrayLength(env, val) == 32);
23467 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23468 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23472 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23474 this_ptr_conv.is_owned = false;
23475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23476 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23481 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23483 this_ptr_conv.is_owned = false;
23484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23485 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23488 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) {
23489 LDKOutPoint outpoint_arg_conv;
23490 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23491 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23492 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23493 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23494 LDKPublicKey per_commitment_point_arg_ref;
23495 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
23496 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
23497 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
23498 CHECK_ACCESS(output_arg_ptr);
23499 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23500 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
23501 LDKPublicKey revocation_pubkey_arg_ref;
23502 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
23503 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
23504 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23505 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
23506 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
23507 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);
23508 uint64_t ret_ref = 0;
23509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23512 ret_ref = (uint64_t)ret_var.inner;
23513 if (ret_var.is_owned) {
23519 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23520 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23521 uint64_t ret_ref = 0;
23522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23525 ret_ref = (uint64_t)ret_var.inner;
23526 if (ret_var.is_owned) {
23531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23532 LDKDelayedPaymentOutputDescriptor arg_conv;
23533 arg_conv.inner = (void*)(arg & (~1));
23534 arg_conv.is_owned = false;
23535 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23536 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23541 LDKDelayedPaymentOutputDescriptor orig_conv;
23542 orig_conv.inner = (void*)(orig & (~1));
23543 orig_conv.is_owned = false;
23544 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23545 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
23546 uint64_t ret_ref = 0;
23547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23550 ret_ref = (uint64_t)ret_var.inner;
23551 if (ret_var.is_owned) {
23557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
23558 LDKDelayedPaymentOutputDescriptor obj_conv;
23559 obj_conv.inner = (void*)(obj & (~1));
23560 obj_conv.is_owned = false;
23561 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23562 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23563 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23564 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23565 CVec_u8Z_free(ret_var);
23569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23570 LDKu8slice ser_ref;
23571 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23572 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23573 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23574 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23575 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23576 return (uint64_t)ret_conv;
23579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23580 LDKStaticPaymentOutputDescriptor this_obj_conv;
23581 this_obj_conv.inner = (void*)(this_obj & (~1));
23582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23584 StaticPaymentOutputDescriptor_free(this_obj_conv);
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
23588 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23590 this_ptr_conv.is_owned = false;
23591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23592 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23593 uint64_t ret_ref = 0;
23594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23597 ret_ref = (uint64_t)ret_var.inner;
23598 if (ret_var.is_owned) {
23604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23605 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23607 this_ptr_conv.is_owned = false;
23608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23609 LDKOutPoint val_conv;
23610 val_conv.inner = (void*)(val & (~1));
23611 val_conv.is_owned = (val & 1) || (val == 0);
23612 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23613 val_conv = OutPoint_clone(&val_conv);
23614 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23618 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23620 this_ptr_conv.is_owned = false;
23621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23622 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23623 CHECK_ACCESS(val_ptr);
23624 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23625 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
23626 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23630 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23632 this_ptr_conv.is_owned = false;
23633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23634 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23635 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
23639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23640 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23642 this_ptr_conv.is_owned = false;
23643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23644 LDKThirtyTwoBytes val_ref;
23645 CHECK((*env)->GetArrayLength(env, val) == 32);
23646 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23647 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23651 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23653 this_ptr_conv.is_owned = false;
23654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23655 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23660 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23662 this_ptr_conv.is_owned = false;
23663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23664 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23667 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) {
23668 LDKOutPoint outpoint_arg_conv;
23669 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23670 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23671 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23672 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23673 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
23674 CHECK_ACCESS(output_arg_ptr);
23675 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23676 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
23677 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23678 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
23679 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
23680 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23681 uint64_t ret_ref = 0;
23682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23685 ret_ref = (uint64_t)ret_var.inner;
23686 if (ret_var.is_owned) {
23692 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
23693 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
23694 uint64_t ret_ref = 0;
23695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23698 ret_ref = (uint64_t)ret_var.inner;
23699 if (ret_var.is_owned) {
23704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23705 LDKStaticPaymentOutputDescriptor arg_conv;
23706 arg_conv.inner = (void*)(arg & (~1));
23707 arg_conv.is_owned = false;
23708 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23709 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
23713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23714 LDKStaticPaymentOutputDescriptor orig_conv;
23715 orig_conv.inner = (void*)(orig & (~1));
23716 orig_conv.is_owned = false;
23717 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23718 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
23719 uint64_t ret_ref = 0;
23720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23723 ret_ref = (uint64_t)ret_var.inner;
23724 if (ret_var.is_owned) {
23730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
23731 LDKStaticPaymentOutputDescriptor obj_conv;
23732 obj_conv.inner = (void*)(obj & (~1));
23733 obj_conv.is_owned = false;
23734 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23735 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
23736 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23737 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23738 CVec_u8Z_free(ret_var);
23742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23743 LDKu8slice ser_ref;
23744 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23745 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23746 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
23747 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
23748 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23749 return (uint64_t)ret_conv;
23752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23753 if ((this_ptr & 1) != 0) return;
23754 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23755 CHECK_ACCESS(this_ptr_ptr);
23756 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
23757 FREE((void*)this_ptr);
23758 SpendableOutputDescriptor_free(this_ptr_conv);
23761 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
23762 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23763 *ret_copy = SpendableOutputDescriptor_clone(arg);
23764 uint64_t ret_ref = (uint64_t)ret_copy;
23767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23768 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
23769 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
23773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23774 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
23775 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23776 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
23777 uint64_t ret_ref = (uint64_t)ret_copy;
23781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
23782 LDKOutPoint outpoint_conv;
23783 outpoint_conv.inner = (void*)(outpoint & (~1));
23784 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
23785 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
23786 outpoint_conv = OutPoint_clone(&outpoint_conv);
23787 void* output_ptr = (void*)(((uint64_t)output) & ~1);
23788 CHECK_ACCESS(output_ptr);
23789 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
23790 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
23791 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23792 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
23793 uint64_t ret_ref = (uint64_t)ret_copy;
23797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
23798 LDKDelayedPaymentOutputDescriptor a_conv;
23799 a_conv.inner = (void*)(a & (~1));
23800 a_conv.is_owned = (a & 1) || (a == 0);
23801 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23802 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
23803 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23804 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
23805 uint64_t ret_ref = (uint64_t)ret_copy;
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
23810 LDKStaticPaymentOutputDescriptor a_conv;
23811 a_conv.inner = (void*)(a & (~1));
23812 a_conv.is_owned = (a & 1) || (a == 0);
23813 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23814 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
23815 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23816 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
23817 uint64_t ret_ref = (uint64_t)ret_copy;
23821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
23822 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
23823 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
23824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23826 CVec_u8Z_free(ret_var);
23830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23831 LDKu8slice ser_ref;
23832 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23833 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23834 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
23835 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
23836 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23837 return (uint64_t)ret_conv;
23840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23841 if ((this_ptr & 1) != 0) return;
23842 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23843 CHECK_ACCESS(this_ptr_ptr);
23844 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
23845 FREE((void*)this_ptr);
23846 BaseSign_free(this_ptr_conv);
23849 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
23850 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23851 *ret_ret = Sign_clone(arg);
23852 return (uint64_t)ret_ret;
23854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23855 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
23856 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23857 LDKSign* arg_conv = (LDKSign*)arg_ptr;
23858 int64_t ret_val = Sign_clone_ptr(arg_conv);
23862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23863 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
23864 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
23865 LDKSign* orig_conv = (LDKSign*)orig_ptr;
23866 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23867 *ret_ret = Sign_clone(orig_conv);
23868 return (uint64_t)ret_ret;
23871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23872 if ((this_ptr & 1) != 0) return;
23873 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23874 CHECK_ACCESS(this_ptr_ptr);
23875 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
23876 FREE((void*)this_ptr);
23877 Sign_free(this_ptr_conv);
23880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23881 if ((this_ptr & 1) != 0) return;
23882 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23883 CHECK_ACCESS(this_ptr_ptr);
23884 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
23885 FREE((void*)this_ptr);
23886 KeysInterface_free(this_ptr_conv);
23889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23890 LDKInMemorySigner this_obj_conv;
23891 this_obj_conv.inner = (void*)(this_obj & (~1));
23892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23894 InMemorySigner_free(this_obj_conv);
23897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
23898 LDKInMemorySigner this_ptr_conv;
23899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23900 this_ptr_conv.is_owned = false;
23901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23902 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23903 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
23907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23908 LDKInMemorySigner this_ptr_conv;
23909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23910 this_ptr_conv.is_owned = false;
23911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23912 LDKSecretKey val_ref;
23913 CHECK((*env)->GetArrayLength(env, val) == 32);
23914 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
23915 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
23918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
23919 LDKInMemorySigner this_ptr_conv;
23920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23921 this_ptr_conv.is_owned = false;
23922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23923 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23924 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
23928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23929 LDKInMemorySigner this_ptr_conv;
23930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23931 this_ptr_conv.is_owned = false;
23932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23933 LDKSecretKey val_ref;
23934 CHECK((*env)->GetArrayLength(env, val) == 32);
23935 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
23936 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
23939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
23940 LDKInMemorySigner this_ptr_conv;
23941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23942 this_ptr_conv.is_owned = false;
23943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23944 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
23949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23950 LDKInMemorySigner this_ptr_conv;
23951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23952 this_ptr_conv.is_owned = false;
23953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23954 LDKSecretKey val_ref;
23955 CHECK((*env)->GetArrayLength(env, val) == 32);
23956 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
23957 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
23960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
23961 LDKInMemorySigner this_ptr_conv;
23962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23963 this_ptr_conv.is_owned = false;
23964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23965 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23966 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
23970 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) {
23971 LDKInMemorySigner this_ptr_conv;
23972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23973 this_ptr_conv.is_owned = false;
23974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23975 LDKSecretKey val_ref;
23976 CHECK((*env)->GetArrayLength(env, val) == 32);
23977 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
23978 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
23981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
23982 LDKInMemorySigner this_ptr_conv;
23983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23984 this_ptr_conv.is_owned = false;
23985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23986 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23987 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
23991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23992 LDKInMemorySigner this_ptr_conv;
23993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23994 this_ptr_conv.is_owned = false;
23995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23996 LDKSecretKey val_ref;
23997 CHECK((*env)->GetArrayLength(env, val) == 32);
23998 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
23999 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
24002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
24003 LDKInMemorySigner this_ptr_conv;
24004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24005 this_ptr_conv.is_owned = false;
24006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24007 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24008 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
24012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24013 LDKInMemorySigner this_ptr_conv;
24014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24015 this_ptr_conv.is_owned = false;
24016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24017 LDKThirtyTwoBytes val_ref;
24018 CHECK((*env)->GetArrayLength(env, val) == 32);
24019 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24020 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
24023 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
24024 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
24025 uint64_t ret_ref = 0;
24026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24029 ret_ref = (uint64_t)ret_var.inner;
24030 if (ret_var.is_owned) {
24035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24036 LDKInMemorySigner arg_conv;
24037 arg_conv.inner = (void*)(arg & (~1));
24038 arg_conv.is_owned = false;
24039 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24040 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
24044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24045 LDKInMemorySigner orig_conv;
24046 orig_conv.inner = (void*)(orig & (~1));
24047 orig_conv.is_owned = false;
24048 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24049 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
24050 uint64_t ret_ref = 0;
24051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24054 ret_ref = (uint64_t)ret_var.inner;
24055 if (ret_var.is_owned) {
24061 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) {
24062 LDKSecretKey funding_key_ref;
24063 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
24064 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
24065 LDKSecretKey revocation_base_key_ref;
24066 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
24067 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
24068 LDKSecretKey payment_key_ref;
24069 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
24070 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
24071 LDKSecretKey delayed_payment_base_key_ref;
24072 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
24073 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
24074 LDKSecretKey htlc_base_key_ref;
24075 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
24076 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
24077 LDKThirtyTwoBytes commitment_seed_ref;
24078 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
24079 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
24080 LDKThirtyTwoBytes channel_keys_id_ref;
24081 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
24082 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
24083 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);
24084 uint64_t ret_ref = 0;
24085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24088 ret_ref = (uint64_t)ret_var.inner;
24089 if (ret_var.is_owned) {
24095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
24096 LDKInMemorySigner this_arg_conv;
24097 this_arg_conv.inner = (void*)(this_arg & (~1));
24098 this_arg_conv.is_owned = false;
24099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24100 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
24101 uint64_t ret_ref = 0;
24102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24105 ret_ref = (uint64_t)ret_var.inner;
24106 if (ret_var.is_owned) {
24112 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
24113 LDKInMemorySigner this_arg_conv;
24114 this_arg_conv.inner = (void*)(this_arg & (~1));
24115 this_arg_conv.is_owned = false;
24116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24117 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
24121 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
24122 LDKInMemorySigner this_arg_conv;
24123 this_arg_conv.inner = (void*)(this_arg & (~1));
24124 this_arg_conv.is_owned = false;
24125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24126 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
24130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
24131 LDKInMemorySigner this_arg_conv;
24132 this_arg_conv.inner = (void*)(this_arg & (~1));
24133 this_arg_conv.is_owned = false;
24134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24135 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
24139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
24140 LDKInMemorySigner this_arg_conv;
24141 this_arg_conv.inner = (void*)(this_arg & (~1));
24142 this_arg_conv.is_owned = false;
24143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24144 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24145 uint64_t ret_ref = 0;
24146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24149 ret_ref = (uint64_t)ret_var.inner;
24150 if (ret_var.is_owned) {
24156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
24157 LDKInMemorySigner this_arg_conv;
24158 this_arg_conv.inner = (void*)(this_arg & (~1));
24159 this_arg_conv.is_owned = false;
24160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24161 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24162 uint64_t ret_ref = 0;
24163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24166 ret_ref = (uint64_t)ret_var.inner;
24167 if (ret_var.is_owned) {
24173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
24174 LDKInMemorySigner this_arg_conv;
24175 this_arg_conv.inner = (void*)(this_arg & (~1));
24176 this_arg_conv.is_owned = false;
24177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24178 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
24182 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) {
24183 LDKInMemorySigner this_arg_conv;
24184 this_arg_conv.inner = (void*)(this_arg & (~1));
24185 this_arg_conv.is_owned = false;
24186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24187 LDKTransaction spend_tx_ref;
24188 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
24189 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24190 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
24191 spend_tx_ref.data_is_owned = true;
24192 LDKStaticPaymentOutputDescriptor descriptor_conv;
24193 descriptor_conv.inner = (void*)(descriptor & (~1));
24194 descriptor_conv.is_owned = false;
24195 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24196 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24197 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24198 return (uint64_t)ret_conv;
24201 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) {
24202 LDKInMemorySigner this_arg_conv;
24203 this_arg_conv.inner = (void*)(this_arg & (~1));
24204 this_arg_conv.is_owned = false;
24205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24206 LDKTransaction spend_tx_ref;
24207 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
24208 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24209 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
24210 spend_tx_ref.data_is_owned = true;
24211 LDKDelayedPaymentOutputDescriptor descriptor_conv;
24212 descriptor_conv.inner = (void*)(descriptor & (~1));
24213 descriptor_conv.is_owned = false;
24214 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24215 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24216 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24217 return (uint64_t)ret_conv;
24220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
24221 LDKInMemorySigner this_arg_conv;
24222 this_arg_conv.inner = (void*)(this_arg & (~1));
24223 this_arg_conv.is_owned = false;
24224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24225 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24226 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24227 return (uint64_t)ret_ret;
24230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
24231 LDKInMemorySigner this_arg_conv;
24232 this_arg_conv.inner = (void*)(this_arg & (~1));
24233 this_arg_conv.is_owned = false;
24234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24235 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24236 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24237 return (uint64_t)ret_ret;
24240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
24241 LDKInMemorySigner obj_conv;
24242 obj_conv.inner = (void*)(obj & (~1));
24243 obj_conv.is_owned = false;
24244 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24245 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24246 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24247 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24248 CVec_u8Z_free(ret_var);
24252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24253 LDKu8slice ser_ref;
24254 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24255 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24256 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24257 *ret_conv = InMemorySigner_read(ser_ref);
24258 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24259 return (uint64_t)ret_conv;
24262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24263 LDKKeysManager this_obj_conv;
24264 this_obj_conv.inner = (void*)(this_obj & (~1));
24265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24267 KeysManager_free(this_obj_conv);
24270 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) {
24271 unsigned char seed_arr[32];
24272 CHECK((*env)->GetArrayLength(env, seed) == 32);
24273 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
24274 unsigned char (*seed_ref)[32] = &seed_arr;
24275 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24276 uint64_t ret_ref = 0;
24277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24280 ret_ref = (uint64_t)ret_var.inner;
24281 if (ret_var.is_owned) {
24287 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) {
24288 LDKKeysManager this_arg_conv;
24289 this_arg_conv.inner = (void*)(this_arg & (~1));
24290 this_arg_conv.is_owned = false;
24291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24292 unsigned char params_arr[32];
24293 CHECK((*env)->GetArrayLength(env, params) == 32);
24294 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
24295 unsigned char (*params_ref)[32] = ¶ms_arr;
24296 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24297 uint64_t ret_ref = 0;
24298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24301 ret_ref = (uint64_t)ret_var.inner;
24302 if (ret_var.is_owned) {
24308 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) {
24309 LDKKeysManager this_arg_conv;
24310 this_arg_conv.inner = (void*)(this_arg & (~1));
24311 this_arg_conv.is_owned = false;
24312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24313 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24314 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
24315 if (descriptors_constr.datalen > 0)
24316 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24318 descriptors_constr.data = NULL;
24319 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
24320 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24321 int64_t descriptors_conv_27 = descriptors_vals[b];
24322 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
24323 CHECK_ACCESS(descriptors_conv_27_ptr);
24324 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24325 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
24326 descriptors_constr.data[b] = descriptors_conv_27_conv;
24328 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
24329 LDKCVec_TxOutZ outputs_constr;
24330 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
24331 if (outputs_constr.datalen > 0)
24332 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24334 outputs_constr.data = NULL;
24335 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
24336 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24337 int64_t outputs_conv_7 = outputs_vals[h];
24338 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
24339 CHECK_ACCESS(outputs_conv_7_ptr);
24340 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24341 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
24342 outputs_constr.data[h] = outputs_conv_7_conv;
24344 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
24345 LDKCVec_u8Z change_destination_script_ref;
24346 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
24347 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24348 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
24349 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24350 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24351 return (uint64_t)ret_conv;
24354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
24355 LDKKeysManager this_arg_conv;
24356 this_arg_conv.inner = (void*)(this_arg & (~1));
24357 this_arg_conv.is_owned = false;
24358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24359 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24360 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24361 return (uint64_t)ret_ret;
24364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24365 LDKChannelManager this_obj_conv;
24366 this_obj_conv.inner = (void*)(this_obj & (~1));
24367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24369 ChannelManager_free(this_obj_conv);
24372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24373 LDKChainParameters this_obj_conv;
24374 this_obj_conv.inner = (void*)(this_obj & (~1));
24375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24377 ChainParameters_free(this_obj_conv);
24380 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
24381 LDKChainParameters this_ptr_conv;
24382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24383 this_ptr_conv.is_owned = false;
24384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24385 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
24389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24390 LDKChainParameters this_ptr_conv;
24391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24392 this_ptr_conv.is_owned = false;
24393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24394 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
24395 ChainParameters_set_network(&this_ptr_conv, val_conv);
24398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
24399 LDKChainParameters this_ptr_conv;
24400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24401 this_ptr_conv.is_owned = false;
24402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24403 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24404 uint64_t ret_ref = 0;
24405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24408 ret_ref = (uint64_t)ret_var.inner;
24409 if (ret_var.is_owned) {
24415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24416 LDKChainParameters this_ptr_conv;
24417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24418 this_ptr_conv.is_owned = false;
24419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24420 LDKBestBlock val_conv;
24421 val_conv.inner = (void*)(val & (~1));
24422 val_conv.is_owned = (val & 1) || (val == 0);
24423 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24424 val_conv = BestBlock_clone(&val_conv);
24425 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
24429 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
24430 LDKBestBlock best_block_arg_conv;
24431 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
24432 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
24433 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24434 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24435 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24436 uint64_t ret_ref = 0;
24437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24440 ret_ref = (uint64_t)ret_var.inner;
24441 if (ret_var.is_owned) {
24447 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24448 LDKChainParameters ret_var = ChainParameters_clone(arg);
24449 uint64_t ret_ref = 0;
24450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24453 ret_ref = (uint64_t)ret_var.inner;
24454 if (ret_var.is_owned) {
24459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24460 LDKChainParameters arg_conv;
24461 arg_conv.inner = (void*)(arg & (~1));
24462 arg_conv.is_owned = false;
24463 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24464 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
24468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24469 LDKChainParameters orig_conv;
24470 orig_conv.inner = (void*)(orig & (~1));
24471 orig_conv.is_owned = false;
24472 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24473 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24474 uint64_t ret_ref = 0;
24475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24478 ret_ref = (uint64_t)ret_var.inner;
24479 if (ret_var.is_owned) {
24485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24486 LDKCounterpartyForwardingInfo this_obj_conv;
24487 this_obj_conv.inner = (void*)(this_obj & (~1));
24488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24490 CounterpartyForwardingInfo_free(this_obj_conv);
24493 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24494 LDKCounterpartyForwardingInfo this_ptr_conv;
24495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24496 this_ptr_conv.is_owned = false;
24497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24498 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24503 LDKCounterpartyForwardingInfo this_ptr_conv;
24504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24505 this_ptr_conv.is_owned = false;
24506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24507 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24510 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24511 LDKCounterpartyForwardingInfo this_ptr_conv;
24512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24513 this_ptr_conv.is_owned = false;
24514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24515 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24520 LDKCounterpartyForwardingInfo this_ptr_conv;
24521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24522 this_ptr_conv.is_owned = false;
24523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24524 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24527 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24528 LDKCounterpartyForwardingInfo this_ptr_conv;
24529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24530 this_ptr_conv.is_owned = false;
24531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24532 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24537 LDKCounterpartyForwardingInfo this_ptr_conv;
24538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24539 this_ptr_conv.is_owned = false;
24540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24541 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
24545 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24546 uint64_t ret_ref = 0;
24547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24550 ret_ref = (uint64_t)ret_var.inner;
24551 if (ret_var.is_owned) {
24557 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
24558 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
24559 uint64_t ret_ref = 0;
24560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24563 ret_ref = (uint64_t)ret_var.inner;
24564 if (ret_var.is_owned) {
24569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24570 LDKCounterpartyForwardingInfo arg_conv;
24571 arg_conv.inner = (void*)(arg & (~1));
24572 arg_conv.is_owned = false;
24573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24574 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24579 LDKCounterpartyForwardingInfo orig_conv;
24580 orig_conv.inner = (void*)(orig & (~1));
24581 orig_conv.is_owned = false;
24582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24583 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
24584 uint64_t ret_ref = 0;
24585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24588 ret_ref = (uint64_t)ret_var.inner;
24589 if (ret_var.is_owned) {
24595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24596 LDKChannelCounterparty this_obj_conv;
24597 this_obj_conv.inner = (void*)(this_obj & (~1));
24598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24600 ChannelCounterparty_free(this_obj_conv);
24603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24604 LDKChannelCounterparty this_ptr_conv;
24605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24606 this_ptr_conv.is_owned = false;
24607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24608 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24609 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
24613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24614 LDKChannelCounterparty this_ptr_conv;
24615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24616 this_ptr_conv.is_owned = false;
24617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24618 LDKPublicKey val_ref;
24619 CHECK((*env)->GetArrayLength(env, val) == 33);
24620 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24621 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
24624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24625 LDKChannelCounterparty this_ptr_conv;
24626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24627 this_ptr_conv.is_owned = false;
24628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24629 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
24630 uint64_t ret_ref = 0;
24631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24634 ret_ref = (uint64_t)ret_var.inner;
24635 if (ret_var.is_owned) {
24641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24642 LDKChannelCounterparty this_ptr_conv;
24643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24644 this_ptr_conv.is_owned = false;
24645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24646 LDKInitFeatures val_conv;
24647 val_conv.inner = (void*)(val & (~1));
24648 val_conv.is_owned = (val & 1) || (val == 0);
24649 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24650 val_conv = InitFeatures_clone(&val_conv);
24651 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
24654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
24655 LDKChannelCounterparty this_ptr_conv;
24656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24657 this_ptr_conv.is_owned = false;
24658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24659 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
24663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24664 LDKChannelCounterparty this_ptr_conv;
24665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24666 this_ptr_conv.is_owned = false;
24667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24668 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
24671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24672 LDKChannelCounterparty this_ptr_conv;
24673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24674 this_ptr_conv.is_owned = false;
24675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24676 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
24677 uint64_t ret_ref = 0;
24678 if ((uint64_t)ret_var.inner > 4096) {
24679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24682 ret_ref = (uint64_t)ret_var.inner;
24683 if (ret_var.is_owned) {
24690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24691 LDKChannelCounterparty this_ptr_conv;
24692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24693 this_ptr_conv.is_owned = false;
24694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24695 LDKCounterpartyForwardingInfo val_conv;
24696 val_conv.inner = (void*)(val & (~1));
24697 val_conv.is_owned = (val & 1) || (val == 0);
24698 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24699 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
24700 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
24703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
24704 LDKPublicKey node_id_arg_ref;
24705 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
24706 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
24707 LDKInitFeatures features_arg_conv;
24708 features_arg_conv.inner = (void*)(features_arg & (~1));
24709 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24710 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
24711 features_arg_conv = InitFeatures_clone(&features_arg_conv);
24712 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
24713 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
24714 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
24715 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
24716 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
24717 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
24718 uint64_t ret_ref = 0;
24719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24722 ret_ref = (uint64_t)ret_var.inner;
24723 if (ret_var.is_owned) {
24729 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
24730 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
24731 uint64_t ret_ref = 0;
24732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24735 ret_ref = (uint64_t)ret_var.inner;
24736 if (ret_var.is_owned) {
24741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24742 LDKChannelCounterparty arg_conv;
24743 arg_conv.inner = (void*)(arg & (~1));
24744 arg_conv.is_owned = false;
24745 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24746 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
24750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24751 LDKChannelCounterparty orig_conv;
24752 orig_conv.inner = (void*)(orig & (~1));
24753 orig_conv.is_owned = false;
24754 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24755 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
24756 uint64_t ret_ref = 0;
24757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24760 ret_ref = (uint64_t)ret_var.inner;
24761 if (ret_var.is_owned) {
24767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24768 LDKChannelDetails this_obj_conv;
24769 this_obj_conv.inner = (void*)(this_obj & (~1));
24770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24772 ChannelDetails_free(this_obj_conv);
24775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24776 LDKChannelDetails this_ptr_conv;
24777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24778 this_ptr_conv.is_owned = false;
24779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24780 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
24785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24786 LDKChannelDetails this_ptr_conv;
24787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24788 this_ptr_conv.is_owned = false;
24789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24790 LDKThirtyTwoBytes val_ref;
24791 CHECK((*env)->GetArrayLength(env, val) == 32);
24792 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24793 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
24796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
24797 LDKChannelDetails this_ptr_conv;
24798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24799 this_ptr_conv.is_owned = false;
24800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24801 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
24802 uint64_t ret_ref = 0;
24803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24806 ret_ref = (uint64_t)ret_var.inner;
24807 if (ret_var.is_owned) {
24813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24814 LDKChannelDetails this_ptr_conv;
24815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24816 this_ptr_conv.is_owned = false;
24817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24818 LDKChannelCounterparty val_conv;
24819 val_conv.inner = (void*)(val & (~1));
24820 val_conv.is_owned = (val & 1) || (val == 0);
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24822 val_conv = ChannelCounterparty_clone(&val_conv);
24823 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
24826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
24827 LDKChannelDetails this_ptr_conv;
24828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24829 this_ptr_conv.is_owned = false;
24830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24831 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
24832 uint64_t ret_ref = 0;
24833 if ((uint64_t)ret_var.inner > 4096) {
24834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24837 ret_ref = (uint64_t)ret_var.inner;
24838 if (ret_var.is_owned) {
24845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24846 LDKChannelDetails this_ptr_conv;
24847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24848 this_ptr_conv.is_owned = false;
24849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24850 LDKOutPoint val_conv;
24851 val_conv.inner = (void*)(val & (~1));
24852 val_conv.is_owned = (val & 1) || (val == 0);
24853 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24854 val_conv = OutPoint_clone(&val_conv);
24855 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
24858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24859 LDKChannelDetails this_ptr_conv;
24860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24861 this_ptr_conv.is_owned = false;
24862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24863 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24864 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
24865 uint64_t ret_ref = (uint64_t)ret_copy;
24869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24870 LDKChannelDetails this_ptr_conv;
24871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24872 this_ptr_conv.is_owned = false;
24873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24874 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24875 CHECK_ACCESS(val_ptr);
24876 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24877 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24878 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
24881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24882 LDKChannelDetails this_ptr_conv;
24883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24884 this_ptr_conv.is_owned = false;
24885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24886 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
24890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24891 LDKChannelDetails this_ptr_conv;
24892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24893 this_ptr_conv.is_owned = false;
24894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24895 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
24898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
24899 LDKChannelDetails this_ptr_conv;
24900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24901 this_ptr_conv.is_owned = false;
24902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24903 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24904 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
24905 uint64_t ret_ref = (uint64_t)ret_copy;
24909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24910 LDKChannelDetails this_ptr_conv;
24911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24912 this_ptr_conv.is_owned = false;
24913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24914 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24915 CHECK_ACCESS(val_ptr);
24916 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24917 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24918 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
24921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24922 LDKChannelDetails this_ptr_conv;
24923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24924 this_ptr_conv.is_owned = false;
24925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24926 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
24930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24931 LDKChannelDetails this_ptr_conv;
24932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24933 this_ptr_conv.is_owned = false;
24934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24935 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
24938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24939 LDKChannelDetails this_ptr_conv;
24940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24941 this_ptr_conv.is_owned = false;
24942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24943 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
24947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24948 LDKChannelDetails this_ptr_conv;
24949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24950 this_ptr_conv.is_owned = false;
24951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24952 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
24955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24956 LDKChannelDetails this_ptr_conv;
24957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24958 this_ptr_conv.is_owned = false;
24959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24960 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
24964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24965 LDKChannelDetails this_ptr_conv;
24966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24967 this_ptr_conv.is_owned = false;
24968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24969 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
24972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24973 LDKChannelDetails this_ptr_conv;
24974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24975 this_ptr_conv.is_owned = false;
24976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24977 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
24981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24982 LDKChannelDetails this_ptr_conv;
24983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24984 this_ptr_conv.is_owned = false;
24985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24986 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
24989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
24990 LDKChannelDetails this_ptr_conv;
24991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24992 this_ptr_conv.is_owned = false;
24993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24994 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24995 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
24996 uint64_t ret_ref = (uint64_t)ret_copy;
25000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25001 LDKChannelDetails this_ptr_conv;
25002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25003 this_ptr_conv.is_owned = false;
25004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25005 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25006 CHECK_ACCESS(val_ptr);
25007 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25008 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
25009 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25013 LDKChannelDetails this_ptr_conv;
25014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25015 this_ptr_conv.is_owned = false;
25016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25017 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25018 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25019 uint64_t ret_ref = (uint64_t)ret_copy;
25023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25024 LDKChannelDetails this_ptr_conv;
25025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25026 this_ptr_conv.is_owned = false;
25027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25028 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25029 CHECK_ACCESS(val_ptr);
25030 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25031 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
25032 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
25036 LDKChannelDetails this_ptr_conv;
25037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25038 this_ptr_conv.is_owned = false;
25039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25040 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
25044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25045 LDKChannelDetails this_ptr_conv;
25046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25047 this_ptr_conv.is_owned = false;
25048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25049 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
25053 LDKChannelDetails this_ptr_conv;
25054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25055 this_ptr_conv.is_owned = false;
25056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25057 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
25061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25062 LDKChannelDetails this_ptr_conv;
25063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25064 this_ptr_conv.is_owned = false;
25065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25066 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
25069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
25070 LDKChannelDetails this_ptr_conv;
25071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25072 this_ptr_conv.is_owned = false;
25073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25074 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
25078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25079 LDKChannelDetails this_ptr_conv;
25080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25081 this_ptr_conv.is_owned = false;
25082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25083 ChannelDetails_set_is_usable(&this_ptr_conv, val);
25086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
25087 LDKChannelDetails this_ptr_conv;
25088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25089 this_ptr_conv.is_owned = false;
25090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25091 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
25095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25096 LDKChannelDetails this_ptr_conv;
25097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25098 this_ptr_conv.is_owned = false;
25099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25100 ChannelDetails_set_is_public(&this_ptr_conv, val);
25103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
25104 LDKThirtyTwoBytes channel_id_arg_ref;
25105 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
25106 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
25107 LDKChannelCounterparty counterparty_arg_conv;
25108 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
25109 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
25110 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25111 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25112 LDKOutPoint funding_txo_arg_conv;
25113 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
25114 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
25115 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25116 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25117 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
25118 CHECK_ACCESS(short_channel_id_arg_ptr);
25119 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25120 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
25121 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
25122 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25123 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25124 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
25125 CHECK_ACCESS(confirmations_required_arg_ptr);
25126 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25127 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
25128 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
25129 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25130 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25131 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
25132 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
25133 uint64_t ret_ref = 0;
25134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25137 ret_ref = (uint64_t)ret_var.inner;
25138 if (ret_var.is_owned) {
25144 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25145 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25146 uint64_t ret_ref = 0;
25147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25150 ret_ref = (uint64_t)ret_var.inner;
25151 if (ret_var.is_owned) {
25156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25157 LDKChannelDetails arg_conv;
25158 arg_conv.inner = (void*)(arg & (~1));
25159 arg_conv.is_owned = false;
25160 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25161 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
25165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25166 LDKChannelDetails orig_conv;
25167 orig_conv.inner = (void*)(orig & (~1));
25168 orig_conv.is_owned = false;
25169 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25170 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25171 uint64_t ret_ref = 0;
25172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25175 ret_ref = (uint64_t)ret_var.inner;
25176 if (ret_var.is_owned) {
25182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25183 if ((this_ptr & 1) != 0) return;
25184 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25185 CHECK_ACCESS(this_ptr_ptr);
25186 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25187 FREE((void*)this_ptr);
25188 PaymentSendFailure_free(this_ptr_conv);
25191 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25192 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25193 *ret_copy = PaymentSendFailure_clone(arg);
25194 uint64_t ret_ref = (uint64_t)ret_copy;
25197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25198 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
25199 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
25203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25204 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
25205 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25206 *ret_copy = PaymentSendFailure_clone(orig_conv);
25207 uint64_t ret_ref = (uint64_t)ret_copy;
25211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
25212 void* a_ptr = (void*)(((uint64_t)a) & ~1);
25213 CHECK_ACCESS(a_ptr);
25214 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25215 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
25216 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25217 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25218 uint64_t ret_ref = (uint64_t)ret_copy;
25222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
25223 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25224 a_constr.datalen = (*env)->GetArrayLength(env, a);
25225 if (a_constr.datalen > 0)
25226 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25228 a_constr.data = NULL;
25229 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
25230 for (size_t w = 0; w < a_constr.datalen; w++) {
25231 int64_t a_conv_22 = a_vals[w];
25232 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
25233 CHECK_ACCESS(a_conv_22_ptr);
25234 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25235 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
25236 a_constr.data[w] = a_conv_22_conv;
25238 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
25239 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25240 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25241 uint64_t ret_ref = (uint64_t)ret_copy;
25245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
25246 LDKCVec_APIErrorZ a_constr;
25247 a_constr.datalen = (*env)->GetArrayLength(env, a);
25248 if (a_constr.datalen > 0)
25249 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25251 a_constr.data = NULL;
25252 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
25253 for (size_t k = 0; k < a_constr.datalen; k++) {
25254 int64_t a_conv_10 = a_vals[k];
25255 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
25256 CHECK_ACCESS(a_conv_10_ptr);
25257 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25258 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
25259 a_constr.data[k] = a_conv_10_conv;
25261 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
25262 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25263 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25264 uint64_t ret_ref = (uint64_t)ret_copy;
25268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
25269 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25270 results_constr.datalen = (*env)->GetArrayLength(env, results);
25271 if (results_constr.datalen > 0)
25272 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25274 results_constr.data = NULL;
25275 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
25276 for (size_t w = 0; w < results_constr.datalen; w++) {
25277 int64_t results_conv_22 = results_vals[w];
25278 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
25279 CHECK_ACCESS(results_conv_22_ptr);
25280 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25281 results_constr.data[w] = results_conv_22_conv;
25283 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
25284 LDKRouteParameters failed_paths_retry_conv;
25285 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
25286 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
25287 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25288 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25289 LDKThirtyTwoBytes payment_id_ref;
25290 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25291 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25292 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25293 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25294 uint64_t ret_ref = (uint64_t)ret_copy;
25298 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) {
25299 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
25300 CHECK_ACCESS(fee_est_ptr);
25301 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
25302 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
25303 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25304 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
25306 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
25307 CHECK_ACCESS(chain_monitor_ptr);
25308 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
25309 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
25310 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25311 LDKWatch_JCalls_cloned(&chain_monitor_conv);
25313 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
25314 CHECK_ACCESS(tx_broadcaster_ptr);
25315 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
25316 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25317 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25318 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
25320 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
25321 CHECK_ACCESS(logger_ptr);
25322 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25323 if (logger_conv.free == LDKLogger_JCalls_free) {
25324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25325 LDKLogger_JCalls_cloned(&logger_conv);
25327 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
25328 CHECK_ACCESS(keys_manager_ptr);
25329 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25330 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25331 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25332 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
25334 LDKUserConfig config_conv;
25335 config_conv.inner = (void*)(config & (~1));
25336 config_conv.is_owned = (config & 1) || (config == 0);
25337 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
25338 config_conv = UserConfig_clone(&config_conv);
25339 LDKChainParameters params_conv;
25340 params_conv.inner = (void*)(params & (~1));
25341 params_conv.is_owned = (params & 1) || (params == 0);
25342 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
25343 params_conv = ChainParameters_clone(¶ms_conv);
25344 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
25345 uint64_t ret_ref = 0;
25346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25349 ret_ref = (uint64_t)ret_var.inner;
25350 if (ret_var.is_owned) {
25356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
25357 LDKChannelManager this_arg_conv;
25358 this_arg_conv.inner = (void*)(this_arg & (~1));
25359 this_arg_conv.is_owned = false;
25360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25361 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
25362 uint64_t ret_ref = 0;
25363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25366 ret_ref = (uint64_t)ret_var.inner;
25367 if (ret_var.is_owned) {
25373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, int64_t override_config) {
25374 LDKChannelManager this_arg_conv;
25375 this_arg_conv.inner = (void*)(this_arg & (~1));
25376 this_arg_conv.is_owned = false;
25377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25378 LDKPublicKey their_network_key_ref;
25379 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
25380 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
25381 LDKUserConfig override_config_conv;
25382 override_config_conv.inner = (void*)(override_config & (~1));
25383 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
25384 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
25385 override_config_conv = UserConfig_clone(&override_config_conv);
25386 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
25387 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
25388 return (uint64_t)ret_conv;
25391 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
25392 LDKChannelManager this_arg_conv;
25393 this_arg_conv.inner = (void*)(this_arg & (~1));
25394 this_arg_conv.is_owned = false;
25395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25396 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
25397 int64_tArray ret_arr = NULL;
25398 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25399 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25400 for (size_t q = 0; q < ret_var.datalen; q++) {
25401 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25402 uint64_t ret_conv_16_ref = 0;
25403 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25404 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25406 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
25407 if (ret_conv_16_var.is_owned) {
25408 ret_conv_16_ref |= 1;
25410 ret_arr_ptr[q] = ret_conv_16_ref;
25412 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25413 FREE(ret_var.data);
25417 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
25418 LDKChannelManager this_arg_conv;
25419 this_arg_conv.inner = (void*)(this_arg & (~1));
25420 this_arg_conv.is_owned = false;
25421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25422 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
25423 int64_tArray ret_arr = NULL;
25424 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25425 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25426 for (size_t q = 0; q < ret_var.datalen; q++) {
25427 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25428 uint64_t ret_conv_16_ref = 0;
25429 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25430 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25432 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
25433 if (ret_conv_16_var.is_owned) {
25434 ret_conv_16_ref |= 1;
25436 ret_arr_ptr[q] = ret_conv_16_ref;
25438 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25439 FREE(ret_var.data);
25443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
25444 LDKChannelManager this_arg_conv;
25445 this_arg_conv.inner = (void*)(this_arg & (~1));
25446 this_arg_conv.is_owned = false;
25447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25448 unsigned char channel_id_arr[32];
25449 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25450 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
25451 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25452 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25453 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
25454 return (uint64_t)ret_conv;
25457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
25458 LDKChannelManager this_arg_conv;
25459 this_arg_conv.inner = (void*)(this_arg & (~1));
25460 this_arg_conv.is_owned = false;
25461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25462 unsigned char channel_id_arr[32];
25463 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25464 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
25465 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25466 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25467 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
25468 return (uint64_t)ret_conv;
25471 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) {
25472 LDKChannelManager this_arg_conv;
25473 this_arg_conv.inner = (void*)(this_arg & (~1));
25474 this_arg_conv.is_owned = false;
25475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25476 unsigned char channel_id_arr[32];
25477 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25478 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
25479 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25480 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25481 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
25482 return (uint64_t)ret_conv;
25485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
25486 LDKChannelManager this_arg_conv;
25487 this_arg_conv.inner = (void*)(this_arg & (~1));
25488 this_arg_conv.is_owned = false;
25489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25490 ChannelManager_force_close_all_channels(&this_arg_conv);
25493 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) {
25494 LDKChannelManager this_arg_conv;
25495 this_arg_conv.inner = (void*)(this_arg & (~1));
25496 this_arg_conv.is_owned = false;
25497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25498 LDKRoute route_conv;
25499 route_conv.inner = (void*)(route & (~1));
25500 route_conv.is_owned = false;
25501 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25502 LDKThirtyTwoBytes payment_hash_ref;
25503 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25504 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25505 LDKThirtyTwoBytes payment_secret_ref;
25506 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
25507 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
25508 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
25509 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
25510 return (uint64_t)ret_conv;
25513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
25514 LDKChannelManager this_arg_conv;
25515 this_arg_conv.inner = (void*)(this_arg & (~1));
25516 this_arg_conv.is_owned = false;
25517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25518 LDKRoute route_conv;
25519 route_conv.inner = (void*)(route & (~1));
25520 route_conv.is_owned = false;
25521 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25522 LDKThirtyTwoBytes payment_id_ref;
25523 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25524 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25525 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25526 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
25527 return (uint64_t)ret_conv;
25530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
25531 LDKChannelManager this_arg_conv;
25532 this_arg_conv.inner = (void*)(this_arg & (~1));
25533 this_arg_conv.is_owned = false;
25534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25535 LDKThirtyTwoBytes payment_id_ref;
25536 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25537 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25538 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
25541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
25542 LDKChannelManager this_arg_conv;
25543 this_arg_conv.inner = (void*)(this_arg & (~1));
25544 this_arg_conv.is_owned = false;
25545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25546 LDKRoute route_conv;
25547 route_conv.inner = (void*)(route & (~1));
25548 route_conv.is_owned = false;
25549 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25550 LDKThirtyTwoBytes payment_preimage_ref;
25551 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
25552 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
25553 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
25554 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
25555 return (uint64_t)ret_conv;
25558 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) {
25559 LDKChannelManager this_arg_conv;
25560 this_arg_conv.inner = (void*)(this_arg & (~1));
25561 this_arg_conv.is_owned = false;
25562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25563 unsigned char temporary_channel_id_arr[32];
25564 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
25565 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
25566 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25567 LDKTransaction funding_transaction_ref;
25568 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
25569 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
25570 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
25571 funding_transaction_ref.data_is_owned = true;
25572 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25573 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
25574 return (uint64_t)ret_conv;
25577 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) {
25578 LDKChannelManager this_arg_conv;
25579 this_arg_conv.inner = (void*)(this_arg & (~1));
25580 this_arg_conv.is_owned = false;
25581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25582 LDKThreeBytes rgb_ref;
25583 CHECK((*env)->GetArrayLength(env, rgb) == 3);
25584 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
25585 LDKThirtyTwoBytes alias_ref;
25586 CHECK((*env)->GetArrayLength(env, alias) == 32);
25587 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
25588 LDKCVec_NetAddressZ addresses_constr;
25589 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
25590 if (addresses_constr.datalen > 0)
25591 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25593 addresses_constr.data = NULL;
25594 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
25595 for (size_t m = 0; m < addresses_constr.datalen; m++) {
25596 int64_t addresses_conv_12 = addresses_vals[m];
25597 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
25598 CHECK_ACCESS(addresses_conv_12_ptr);
25599 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
25600 addresses_constr.data[m] = addresses_conv_12_conv;
25602 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
25603 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
25606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
25607 LDKChannelManager this_arg_conv;
25608 this_arg_conv.inner = (void*)(this_arg & (~1));
25609 this_arg_conv.is_owned = false;
25610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25611 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
25614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
25615 LDKChannelManager this_arg_conv;
25616 this_arg_conv.inner = (void*)(this_arg & (~1));
25617 this_arg_conv.is_owned = false;
25618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25619 ChannelManager_timer_tick_occurred(&this_arg_conv);
25622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
25623 LDKChannelManager this_arg_conv;
25624 this_arg_conv.inner = (void*)(this_arg & (~1));
25625 this_arg_conv.is_owned = false;
25626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25627 unsigned char payment_hash_arr[32];
25628 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25629 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
25630 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
25631 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
25635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
25636 LDKChannelManager this_arg_conv;
25637 this_arg_conv.inner = (void*)(this_arg & (~1));
25638 this_arg_conv.is_owned = false;
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25640 LDKThirtyTwoBytes payment_preimage_ref;
25641 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
25642 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
25643 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
25647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
25648 LDKChannelManager this_arg_conv;
25649 this_arg_conv.inner = (void*)(this_arg & (~1));
25650 this_arg_conv.is_owned = false;
25651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25652 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
25657 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) {
25658 LDKChannelManager this_arg_conv;
25659 this_arg_conv.inner = (void*)(this_arg & (~1));
25660 this_arg_conv.is_owned = false;
25661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25662 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
25663 CHECK_ACCESS(min_value_msat_ptr);
25664 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25665 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
25666 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
25667 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25668 return (uint64_t)ret_conv;
25671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25672 LDKChannelManager this_arg_conv;
25673 this_arg_conv.inner = (void*)(this_arg & (~1));
25674 this_arg_conv.is_owned = false;
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25676 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
25677 CHECK_ACCESS(min_value_msat_ptr);
25678 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25679 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
25680 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
25681 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25682 return (uint64_t)ret_conv;
25685 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) {
25686 LDKChannelManager this_arg_conv;
25687 this_arg_conv.inner = (void*)(this_arg & (~1));
25688 this_arg_conv.is_owned = false;
25689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25690 LDKThirtyTwoBytes payment_hash_ref;
25691 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25692 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25693 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
25694 CHECK_ACCESS(min_value_msat_ptr);
25695 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25696 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
25697 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
25698 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25699 return (uint64_t)ret_conv;
25702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25703 LDKChannelManager this_arg_conv;
25704 this_arg_conv.inner = (void*)(this_arg & (~1));
25705 this_arg_conv.is_owned = false;
25706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25707 LDKThirtyTwoBytes payment_hash_ref;
25708 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25709 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25710 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
25711 CHECK_ACCESS(min_value_msat_ptr);
25712 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25713 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
25714 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
25715 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25716 return (uint64_t)ret_conv;
25719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
25720 LDKChannelManager this_arg_conv;
25721 this_arg_conv.inner = (void*)(this_arg & (~1));
25722 this_arg_conv.is_owned = false;
25723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25724 LDKThirtyTwoBytes payment_hash_ref;
25725 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25726 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25727 LDKThirtyTwoBytes payment_secret_ref;
25728 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
25729 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
25730 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
25731 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
25732 return (uint64_t)ret_conv;
25735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25736 LDKChannelManager this_arg_conv;
25737 this_arg_conv.inner = (void*)(this_arg & (~1));
25738 this_arg_conv.is_owned = false;
25739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25740 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25741 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
25742 return (uint64_t)ret_ret;
25745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25746 LDKChannelManager this_arg_conv;
25747 this_arg_conv.inner = (void*)(this_arg & (~1));
25748 this_arg_conv.is_owned = false;
25749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25750 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25751 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
25752 return (uint64_t)ret_ret;
25755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25756 LDKChannelManager this_arg_conv;
25757 this_arg_conv.inner = (void*)(this_arg & (~1));
25758 this_arg_conv.is_owned = false;
25759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25760 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25761 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
25762 return (uint64_t)ret_ret;
25765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25766 LDKChannelManager this_arg_conv;
25767 this_arg_conv.inner = (void*)(this_arg & (~1));
25768 this_arg_conv.is_owned = false;
25769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25770 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25771 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
25772 return (uint64_t)ret_ret;
25775 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) {
25776 LDKChannelManager this_arg_conv;
25777 this_arg_conv.inner = (void*)(this_arg & (~1));
25778 this_arg_conv.is_owned = false;
25779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25780 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
25784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
25785 LDKChannelManager this_arg_conv;
25786 this_arg_conv.inner = (void*)(this_arg & (~1));
25787 this_arg_conv.is_owned = false;
25788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25789 ChannelManager_await_persistable_update(&this_arg_conv);
25792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
25793 LDKChannelManager this_arg_conv;
25794 this_arg_conv.inner = (void*)(this_arg & (~1));
25795 this_arg_conv.is_owned = false;
25796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25797 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
25798 uint64_t ret_ref = 0;
25799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25802 ret_ref = (uint64_t)ret_var.inner;
25803 if (ret_var.is_owned) {
25809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25810 LDKChannelManager this_arg_conv;
25811 this_arg_conv.inner = (void*)(this_arg & (~1));
25812 this_arg_conv.is_owned = false;
25813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25814 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
25815 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
25816 return (uint64_t)ret_ret;
25819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
25820 LDKChannelManager obj_conv;
25821 obj_conv.inner = (void*)(obj & (~1));
25822 obj_conv.is_owned = false;
25823 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25824 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
25825 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25826 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25827 CVec_u8Z_free(ret_var);
25831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25832 LDKChannelManagerReadArgs this_obj_conv;
25833 this_obj_conv.inner = (void*)(this_obj & (~1));
25834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25836 ChannelManagerReadArgs_free(this_obj_conv);
25839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
25840 LDKChannelManagerReadArgs this_ptr_conv;
25841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25842 this_ptr_conv.is_owned = false;
25843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25844 // WARNING: This object doesn't live past this scope, needs clone!
25845 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
25849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25850 LDKChannelManagerReadArgs this_ptr_conv;
25851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25852 this_ptr_conv.is_owned = false;
25853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25854 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25855 CHECK_ACCESS(val_ptr);
25856 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
25857 if (val_conv.free == LDKKeysInterface_JCalls_free) {
25858 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25859 LDKKeysInterface_JCalls_cloned(&val_conv);
25861 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
25864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
25865 LDKChannelManagerReadArgs this_ptr_conv;
25866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25867 this_ptr_conv.is_owned = false;
25868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25869 // WARNING: This object doesn't live past this scope, needs clone!
25870 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
25874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25875 LDKChannelManagerReadArgs this_ptr_conv;
25876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25877 this_ptr_conv.is_owned = false;
25878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25879 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25880 CHECK_ACCESS(val_ptr);
25881 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
25882 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
25883 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25884 LDKFeeEstimator_JCalls_cloned(&val_conv);
25886 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
25889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
25890 LDKChannelManagerReadArgs this_ptr_conv;
25891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25892 this_ptr_conv.is_owned = false;
25893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25894 // WARNING: This object doesn't live past this scope, needs clone!
25895 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
25899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25900 LDKChannelManagerReadArgs this_ptr_conv;
25901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25902 this_ptr_conv.is_owned = false;
25903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25904 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25905 CHECK_ACCESS(val_ptr);
25906 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
25907 if (val_conv.free == LDKWatch_JCalls_free) {
25908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25909 LDKWatch_JCalls_cloned(&val_conv);
25911 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
25914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
25915 LDKChannelManagerReadArgs this_ptr_conv;
25916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25917 this_ptr_conv.is_owned = false;
25918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25919 // WARNING: This object doesn't live past this scope, needs clone!
25920 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
25924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25925 LDKChannelManagerReadArgs this_ptr_conv;
25926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25927 this_ptr_conv.is_owned = false;
25928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25929 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25930 CHECK_ACCESS(val_ptr);
25931 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
25932 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
25933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25934 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
25936 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
25939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
25940 LDKChannelManagerReadArgs this_ptr_conv;
25941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25942 this_ptr_conv.is_owned = false;
25943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25944 // WARNING: This object doesn't live past this scope, needs clone!
25945 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
25949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25950 LDKChannelManagerReadArgs this_ptr_conv;
25951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25952 this_ptr_conv.is_owned = false;
25953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25954 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25955 CHECK_ACCESS(val_ptr);
25956 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
25957 if (val_conv.free == LDKLogger_JCalls_free) {
25958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25959 LDKLogger_JCalls_cloned(&val_conv);
25961 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
25964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25965 LDKChannelManagerReadArgs this_ptr_conv;
25966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25967 this_ptr_conv.is_owned = false;
25968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25969 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
25970 uint64_t ret_ref = 0;
25971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25974 ret_ref = (uint64_t)ret_var.inner;
25975 if (ret_var.is_owned) {
25981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25982 LDKChannelManagerReadArgs this_ptr_conv;
25983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25984 this_ptr_conv.is_owned = false;
25985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25986 LDKUserConfig val_conv;
25987 val_conv.inner = (void*)(val & (~1));
25988 val_conv.is_owned = (val & 1) || (val == 0);
25989 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25990 val_conv = UserConfig_clone(&val_conv);
25991 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
25994 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) {
25995 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
25996 CHECK_ACCESS(keys_manager_ptr);
25997 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25998 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25999 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26000 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26002 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
26003 CHECK_ACCESS(fee_estimator_ptr);
26004 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26005 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26006 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26007 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26009 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
26010 CHECK_ACCESS(chain_monitor_ptr);
26011 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26012 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26014 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26016 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
26017 CHECK_ACCESS(tx_broadcaster_ptr);
26018 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26019 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26020 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26021 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26023 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26024 CHECK_ACCESS(logger_ptr);
26025 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26026 if (logger_conv.free == LDKLogger_JCalls_free) {
26027 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26028 LDKLogger_JCalls_cloned(&logger_conv);
26030 LDKUserConfig default_config_conv;
26031 default_config_conv.inner = (void*)(default_config & (~1));
26032 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
26033 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
26034 default_config_conv = UserConfig_clone(&default_config_conv);
26035 LDKCVec_ChannelMonitorZ channel_monitors_constr;
26036 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
26037 if (channel_monitors_constr.datalen > 0)
26038 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26040 channel_monitors_constr.data = NULL;
26041 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
26042 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
26043 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
26044 LDKChannelMonitor channel_monitors_conv_16_conv;
26045 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
26046 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
26047 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
26048 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
26050 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
26051 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);
26052 uint64_t ret_ref = 0;
26053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26056 ret_ref = (uint64_t)ret_var.inner;
26057 if (ret_var.is_owned) {
26063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26064 LDKu8slice ser_ref;
26065 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26066 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26067 LDKChannelManagerReadArgs arg_conv;
26068 arg_conv.inner = (void*)(arg & (~1));
26069 arg_conv.is_owned = (arg & 1) || (arg == 0);
26070 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26071 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
26072 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
26073 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
26074 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26075 return (uint64_t)ret_conv;
26078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26079 LDKDecodeError this_obj_conv;
26080 this_obj_conv.inner = (void*)(this_obj & (~1));
26081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26083 DecodeError_free(this_obj_conv);
26086 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
26087 LDKDecodeError ret_var = DecodeError_clone(arg);
26088 uint64_t ret_ref = 0;
26089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26092 ret_ref = (uint64_t)ret_var.inner;
26093 if (ret_var.is_owned) {
26098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26099 LDKDecodeError arg_conv;
26100 arg_conv.inner = (void*)(arg & (~1));
26101 arg_conv.is_owned = false;
26102 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26103 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
26107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26108 LDKDecodeError orig_conv;
26109 orig_conv.inner = (void*)(orig & (~1));
26110 orig_conv.is_owned = false;
26111 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26112 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
26113 uint64_t ret_ref = 0;
26114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26117 ret_ref = (uint64_t)ret_var.inner;
26118 if (ret_var.is_owned) {
26124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26125 LDKInit this_obj_conv;
26126 this_obj_conv.inner = (void*)(this_obj & (~1));
26127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26129 Init_free(this_obj_conv);
26132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26133 LDKInit this_ptr_conv;
26134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26135 this_ptr_conv.is_owned = false;
26136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26137 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
26138 uint64_t ret_ref = 0;
26139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26142 ret_ref = (uint64_t)ret_var.inner;
26143 if (ret_var.is_owned) {
26149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26150 LDKInit this_ptr_conv;
26151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26152 this_ptr_conv.is_owned = false;
26153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26154 LDKInitFeatures val_conv;
26155 val_conv.inner = (void*)(val & (~1));
26156 val_conv.is_owned = (val & 1) || (val == 0);
26157 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26158 val_conv = InitFeatures_clone(&val_conv);
26159 Init_set_features(&this_ptr_conv, val_conv);
26162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
26163 LDKInitFeatures features_arg_conv;
26164 features_arg_conv.inner = (void*)(features_arg & (~1));
26165 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26166 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26167 features_arg_conv = InitFeatures_clone(&features_arg_conv);
26168 LDKInit ret_var = Init_new(features_arg_conv);
26169 uint64_t ret_ref = 0;
26170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26173 ret_ref = (uint64_t)ret_var.inner;
26174 if (ret_var.is_owned) {
26180 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
26181 LDKInit ret_var = Init_clone(arg);
26182 uint64_t ret_ref = 0;
26183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26186 ret_ref = (uint64_t)ret_var.inner;
26187 if (ret_var.is_owned) {
26192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26194 arg_conv.inner = (void*)(arg & (~1));
26195 arg_conv.is_owned = false;
26196 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26197 int64_t ret_val = Init_clone_ptr(&arg_conv);
26201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26203 orig_conv.inner = (void*)(orig & (~1));
26204 orig_conv.is_owned = false;
26205 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26206 LDKInit ret_var = Init_clone(&orig_conv);
26207 uint64_t ret_ref = 0;
26208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26211 ret_ref = (uint64_t)ret_var.inner;
26212 if (ret_var.is_owned) {
26218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26219 LDKErrorMessage this_obj_conv;
26220 this_obj_conv.inner = (void*)(this_obj & (~1));
26221 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26223 ErrorMessage_free(this_obj_conv);
26226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26227 LDKErrorMessage this_ptr_conv;
26228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26229 this_ptr_conv.is_owned = false;
26230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26231 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26232 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
26236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26237 LDKErrorMessage this_ptr_conv;
26238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26239 this_ptr_conv.is_owned = false;
26240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26241 LDKThirtyTwoBytes val_ref;
26242 CHECK((*env)->GetArrayLength(env, val) == 32);
26243 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26244 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
26247 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
26248 LDKErrorMessage this_ptr_conv;
26249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26250 this_ptr_conv.is_owned = false;
26251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26252 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
26253 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
26259 LDKErrorMessage this_ptr_conv;
26260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26261 this_ptr_conv.is_owned = false;
26262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26263 LDKStr val_conv = java_to_owned_str(env, val);
26264 ErrorMessage_set_data(&this_ptr_conv, val_conv);
26267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
26268 LDKThirtyTwoBytes channel_id_arg_ref;
26269 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
26270 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
26271 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
26272 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
26273 uint64_t ret_ref = 0;
26274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26277 ret_ref = (uint64_t)ret_var.inner;
26278 if (ret_var.is_owned) {
26284 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
26285 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
26286 uint64_t ret_ref = 0;
26287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26290 ret_ref = (uint64_t)ret_var.inner;
26291 if (ret_var.is_owned) {
26296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26297 LDKErrorMessage arg_conv;
26298 arg_conv.inner = (void*)(arg & (~1));
26299 arg_conv.is_owned = false;
26300 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26301 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
26305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26306 LDKErrorMessage orig_conv;
26307 orig_conv.inner = (void*)(orig & (~1));
26308 orig_conv.is_owned = false;
26309 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26310 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
26311 uint64_t ret_ref = 0;
26312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26315 ret_ref = (uint64_t)ret_var.inner;
26316 if (ret_var.is_owned) {
26322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26323 LDKPing this_obj_conv;
26324 this_obj_conv.inner = (void*)(this_obj & (~1));
26325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26327 Ping_free(this_obj_conv);
26330 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
26331 LDKPing this_ptr_conv;
26332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26333 this_ptr_conv.is_owned = false;
26334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26335 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
26339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26340 LDKPing this_ptr_conv;
26341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26342 this_ptr_conv.is_owned = false;
26343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26344 Ping_set_ponglen(&this_ptr_conv, val);
26347 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
26348 LDKPing this_ptr_conv;
26349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26350 this_ptr_conv.is_owned = false;
26351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
26356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26357 LDKPing this_ptr_conv;
26358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26359 this_ptr_conv.is_owned = false;
26360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26361 Ping_set_byteslen(&this_ptr_conv, val);
26364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
26365 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
26366 uint64_t ret_ref = 0;
26367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26370 ret_ref = (uint64_t)ret_var.inner;
26371 if (ret_var.is_owned) {
26377 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
26378 LDKPing ret_var = Ping_clone(arg);
26379 uint64_t ret_ref = 0;
26380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26383 ret_ref = (uint64_t)ret_var.inner;
26384 if (ret_var.is_owned) {
26389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26391 arg_conv.inner = (void*)(arg & (~1));
26392 arg_conv.is_owned = false;
26393 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26394 int64_t ret_val = Ping_clone_ptr(&arg_conv);
26398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26400 orig_conv.inner = (void*)(orig & (~1));
26401 orig_conv.is_owned = false;
26402 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26403 LDKPing ret_var = Ping_clone(&orig_conv);
26404 uint64_t ret_ref = 0;
26405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26408 ret_ref = (uint64_t)ret_var.inner;
26409 if (ret_var.is_owned) {
26415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26416 LDKPong this_obj_conv;
26417 this_obj_conv.inner = (void*)(this_obj & (~1));
26418 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26420 Pong_free(this_obj_conv);
26423 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
26424 LDKPong this_ptr_conv;
26425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26426 this_ptr_conv.is_owned = false;
26427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26428 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
26432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26433 LDKPong this_ptr_conv;
26434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26435 this_ptr_conv.is_owned = false;
26436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26437 Pong_set_byteslen(&this_ptr_conv, val);
26440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
26441 LDKPong ret_var = Pong_new(byteslen_arg);
26442 uint64_t ret_ref = 0;
26443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26446 ret_ref = (uint64_t)ret_var.inner;
26447 if (ret_var.is_owned) {
26453 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
26454 LDKPong ret_var = Pong_clone(arg);
26455 uint64_t ret_ref = 0;
26456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26459 ret_ref = (uint64_t)ret_var.inner;
26460 if (ret_var.is_owned) {
26465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26467 arg_conv.inner = (void*)(arg & (~1));
26468 arg_conv.is_owned = false;
26469 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26470 int64_t ret_val = Pong_clone_ptr(&arg_conv);
26474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26476 orig_conv.inner = (void*)(orig & (~1));
26477 orig_conv.is_owned = false;
26478 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26479 LDKPong ret_var = Pong_clone(&orig_conv);
26480 uint64_t ret_ref = 0;
26481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26484 ret_ref = (uint64_t)ret_var.inner;
26485 if (ret_var.is_owned) {
26491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26492 LDKOpenChannel this_obj_conv;
26493 this_obj_conv.inner = (void*)(this_obj & (~1));
26494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26496 OpenChannel_free(this_obj_conv);
26499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
26500 LDKOpenChannel this_ptr_conv;
26501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26502 this_ptr_conv.is_owned = false;
26503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26504 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
26509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26510 LDKOpenChannel this_ptr_conv;
26511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26512 this_ptr_conv.is_owned = false;
26513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26514 LDKThirtyTwoBytes val_ref;
26515 CHECK((*env)->GetArrayLength(env, val) == 32);
26516 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26517 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
26520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26521 LDKOpenChannel this_ptr_conv;
26522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26523 this_ptr_conv.is_owned = false;
26524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26525 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26526 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
26530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26531 LDKOpenChannel this_ptr_conv;
26532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26533 this_ptr_conv.is_owned = false;
26534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26535 LDKThirtyTwoBytes val_ref;
26536 CHECK((*env)->GetArrayLength(env, val) == 32);
26537 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26538 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26542 LDKOpenChannel this_ptr_conv;
26543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26544 this_ptr_conv.is_owned = false;
26545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26546 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
26550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26551 LDKOpenChannel this_ptr_conv;
26552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26553 this_ptr_conv.is_owned = false;
26554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26555 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
26558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26559 LDKOpenChannel this_ptr_conv;
26560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26561 this_ptr_conv.is_owned = false;
26562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26563 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
26567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26568 LDKOpenChannel this_ptr_conv;
26569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26570 this_ptr_conv.is_owned = false;
26571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26572 OpenChannel_set_push_msat(&this_ptr_conv, val);
26575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26576 LDKOpenChannel this_ptr_conv;
26577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26578 this_ptr_conv.is_owned = false;
26579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26580 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
26584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26585 LDKOpenChannel this_ptr_conv;
26586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26587 this_ptr_conv.is_owned = false;
26588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26589 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26592 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) {
26593 LDKOpenChannel this_ptr_conv;
26594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26595 this_ptr_conv.is_owned = false;
26596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26597 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26601 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) {
26602 LDKOpenChannel this_ptr_conv;
26603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26604 this_ptr_conv.is_owned = false;
26605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26606 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26610 LDKOpenChannel this_ptr_conv;
26611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26612 this_ptr_conv.is_owned = false;
26613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26614 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26619 LDKOpenChannel this_ptr_conv;
26620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26621 this_ptr_conv.is_owned = false;
26622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26623 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26627 LDKOpenChannel this_ptr_conv;
26628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26629 this_ptr_conv.is_owned = false;
26630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26631 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
26635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26636 LDKOpenChannel this_ptr_conv;
26637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26638 this_ptr_conv.is_owned = false;
26639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26640 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
26643 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
26644 LDKOpenChannel this_ptr_conv;
26645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26646 this_ptr_conv.is_owned = false;
26647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26648 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
26652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26653 LDKOpenChannel this_ptr_conv;
26654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26655 this_ptr_conv.is_owned = false;
26656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26657 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
26660 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26661 LDKOpenChannel this_ptr_conv;
26662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26663 this_ptr_conv.is_owned = false;
26664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26665 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
26669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26670 LDKOpenChannel this_ptr_conv;
26671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26672 this_ptr_conv.is_owned = false;
26673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26674 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
26677 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
26678 LDKOpenChannel this_ptr_conv;
26679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26680 this_ptr_conv.is_owned = false;
26681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26682 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
26686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26687 LDKOpenChannel this_ptr_conv;
26688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26689 this_ptr_conv.is_owned = false;
26690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26691 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
26694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26695 LDKOpenChannel this_ptr_conv;
26696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26697 this_ptr_conv.is_owned = false;
26698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26699 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26700 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
26704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26705 LDKOpenChannel this_ptr_conv;
26706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26707 this_ptr_conv.is_owned = false;
26708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26709 LDKPublicKey val_ref;
26710 CHECK((*env)->GetArrayLength(env, val) == 33);
26711 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26712 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
26715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26716 LDKOpenChannel this_ptr_conv;
26717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26718 this_ptr_conv.is_owned = false;
26719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26720 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26721 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
26725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26726 LDKOpenChannel this_ptr_conv;
26727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26728 this_ptr_conv.is_owned = false;
26729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26730 LDKPublicKey val_ref;
26731 CHECK((*env)->GetArrayLength(env, val) == 33);
26732 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26733 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
26736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26737 LDKOpenChannel this_ptr_conv;
26738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26739 this_ptr_conv.is_owned = false;
26740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26741 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26742 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
26746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26747 LDKOpenChannel this_ptr_conv;
26748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26749 this_ptr_conv.is_owned = false;
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26751 LDKPublicKey val_ref;
26752 CHECK((*env)->GetArrayLength(env, val) == 33);
26753 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26754 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
26757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26758 LDKOpenChannel this_ptr_conv;
26759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26760 this_ptr_conv.is_owned = false;
26761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26762 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26763 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
26767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26768 LDKOpenChannel this_ptr_conv;
26769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26770 this_ptr_conv.is_owned = false;
26771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26772 LDKPublicKey val_ref;
26773 CHECK((*env)->GetArrayLength(env, val) == 33);
26774 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26775 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26779 LDKOpenChannel this_ptr_conv;
26780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26781 this_ptr_conv.is_owned = false;
26782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26783 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
26788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26789 LDKOpenChannel this_ptr_conv;
26790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26791 this_ptr_conv.is_owned = false;
26792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26793 LDKPublicKey val_ref;
26794 CHECK((*env)->GetArrayLength(env, val) == 33);
26795 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26796 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
26799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26800 LDKOpenChannel this_ptr_conv;
26801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26802 this_ptr_conv.is_owned = false;
26803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26804 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
26809 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) {
26810 LDKOpenChannel this_ptr_conv;
26811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26812 this_ptr_conv.is_owned = false;
26813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26814 LDKPublicKey val_ref;
26815 CHECK((*env)->GetArrayLength(env, val) == 33);
26816 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26817 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
26820 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
26821 LDKOpenChannel this_ptr_conv;
26822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26823 this_ptr_conv.is_owned = false;
26824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26825 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
26829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
26830 LDKOpenChannel this_ptr_conv;
26831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26832 this_ptr_conv.is_owned = false;
26833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26834 OpenChannel_set_channel_flags(&this_ptr_conv, val);
26837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
26838 LDKOpenChannel this_ptr_conv;
26839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26840 this_ptr_conv.is_owned = false;
26841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26842 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
26843 uint64_t ret_ref = 0;
26844 if ((uint64_t)ret_var.inner > 4096) {
26845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26848 ret_ref = (uint64_t)ret_var.inner;
26849 if (ret_var.is_owned) {
26856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26857 LDKOpenChannel this_ptr_conv;
26858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26859 this_ptr_conv.is_owned = false;
26860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26861 LDKChannelTypeFeatures val_conv;
26862 val_conv.inner = (void*)(val & (~1));
26863 val_conv.is_owned = (val & 1) || (val == 0);
26864 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26865 val_conv = ChannelTypeFeatures_clone(&val_conv);
26866 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
26869 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
26870 LDKOpenChannel ret_var = OpenChannel_clone(arg);
26871 uint64_t ret_ref = 0;
26872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26875 ret_ref = (uint64_t)ret_var.inner;
26876 if (ret_var.is_owned) {
26881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26882 LDKOpenChannel arg_conv;
26883 arg_conv.inner = (void*)(arg & (~1));
26884 arg_conv.is_owned = false;
26885 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26886 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
26890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26891 LDKOpenChannel orig_conv;
26892 orig_conv.inner = (void*)(orig & (~1));
26893 orig_conv.is_owned = false;
26894 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26895 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
26896 uint64_t ret_ref = 0;
26897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26900 ret_ref = (uint64_t)ret_var.inner;
26901 if (ret_var.is_owned) {
26907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26908 LDKAcceptChannel this_obj_conv;
26909 this_obj_conv.inner = (void*)(this_obj & (~1));
26910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26912 AcceptChannel_free(this_obj_conv);
26915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26916 LDKAcceptChannel this_ptr_conv;
26917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26918 this_ptr_conv.is_owned = false;
26919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26920 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26921 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
26925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26926 LDKAcceptChannel this_ptr_conv;
26927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26928 this_ptr_conv.is_owned = false;
26929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26930 LDKThirtyTwoBytes val_ref;
26931 CHECK((*env)->GetArrayLength(env, val) == 32);
26932 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26933 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26937 LDKAcceptChannel this_ptr_conv;
26938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26939 this_ptr_conv.is_owned = false;
26940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26941 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
26945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26946 LDKAcceptChannel this_ptr_conv;
26947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26948 this_ptr_conv.is_owned = false;
26949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26950 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26953 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) {
26954 LDKAcceptChannel this_ptr_conv;
26955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26956 this_ptr_conv.is_owned = false;
26957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26958 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26962 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) {
26963 LDKAcceptChannel this_ptr_conv;
26964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26965 this_ptr_conv.is_owned = false;
26966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26967 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26971 LDKAcceptChannel this_ptr_conv;
26972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26973 this_ptr_conv.is_owned = false;
26974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26975 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26980 LDKAcceptChannel this_ptr_conv;
26981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26982 this_ptr_conv.is_owned = false;
26983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26984 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26988 LDKAcceptChannel this_ptr_conv;
26989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26990 this_ptr_conv.is_owned = false;
26991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26992 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
26996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26997 LDKAcceptChannel this_ptr_conv;
26998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26999 this_ptr_conv.is_owned = false;
27000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27001 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27004 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
27005 LDKAcceptChannel this_ptr_conv;
27006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27007 this_ptr_conv.is_owned = false;
27008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27009 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
27013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27014 LDKAcceptChannel this_ptr_conv;
27015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27016 this_ptr_conv.is_owned = false;
27017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27018 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
27021 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27022 LDKAcceptChannel this_ptr_conv;
27023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27024 this_ptr_conv.is_owned = false;
27025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27026 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
27030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27031 LDKAcceptChannel this_ptr_conv;
27032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27033 this_ptr_conv.is_owned = false;
27034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27035 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
27038 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
27039 LDKAcceptChannel this_ptr_conv;
27040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27041 this_ptr_conv.is_owned = false;
27042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27043 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
27047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27048 LDKAcceptChannel this_ptr_conv;
27049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27050 this_ptr_conv.is_owned = false;
27051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27052 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27056 LDKAcceptChannel this_ptr_conv;
27057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27058 this_ptr_conv.is_owned = false;
27059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27060 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
27065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27066 LDKAcceptChannel this_ptr_conv;
27067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27068 this_ptr_conv.is_owned = false;
27069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27070 LDKPublicKey val_ref;
27071 CHECK((*env)->GetArrayLength(env, val) == 33);
27072 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27073 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27077 LDKAcceptChannel this_ptr_conv;
27078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27079 this_ptr_conv.is_owned = false;
27080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27081 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27082 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
27086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27087 LDKAcceptChannel this_ptr_conv;
27088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27089 this_ptr_conv.is_owned = false;
27090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27091 LDKPublicKey val_ref;
27092 CHECK((*env)->GetArrayLength(env, val) == 33);
27093 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27094 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27098 LDKAcceptChannel this_ptr_conv;
27099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27100 this_ptr_conv.is_owned = false;
27101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27102 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27103 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
27107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27108 LDKAcceptChannel this_ptr_conv;
27109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27110 this_ptr_conv.is_owned = false;
27111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27112 LDKPublicKey val_ref;
27113 CHECK((*env)->GetArrayLength(env, val) == 33);
27114 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27115 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
27118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27119 LDKAcceptChannel this_ptr_conv;
27120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27121 this_ptr_conv.is_owned = false;
27122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27123 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
27128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27129 LDKAcceptChannel this_ptr_conv;
27130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27131 this_ptr_conv.is_owned = false;
27132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27133 LDKPublicKey val_ref;
27134 CHECK((*env)->GetArrayLength(env, val) == 33);
27135 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27136 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27140 LDKAcceptChannel this_ptr_conv;
27141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27142 this_ptr_conv.is_owned = false;
27143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27144 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
27149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27150 LDKAcceptChannel this_ptr_conv;
27151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27152 this_ptr_conv.is_owned = false;
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27154 LDKPublicKey val_ref;
27155 CHECK((*env)->GetArrayLength(env, val) == 33);
27156 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27157 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27161 LDKAcceptChannel this_ptr_conv;
27162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27163 this_ptr_conv.is_owned = false;
27164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27165 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
27170 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) {
27171 LDKAcceptChannel this_ptr_conv;
27172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27173 this_ptr_conv.is_owned = false;
27174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27175 LDKPublicKey val_ref;
27176 CHECK((*env)->GetArrayLength(env, val) == 33);
27177 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27178 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
27181 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
27182 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
27183 uint64_t ret_ref = 0;
27184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27187 ret_ref = (uint64_t)ret_var.inner;
27188 if (ret_var.is_owned) {
27193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27194 LDKAcceptChannel arg_conv;
27195 arg_conv.inner = (void*)(arg & (~1));
27196 arg_conv.is_owned = false;
27197 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27198 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
27202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27203 LDKAcceptChannel orig_conv;
27204 orig_conv.inner = (void*)(orig & (~1));
27205 orig_conv.is_owned = false;
27206 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27207 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
27208 uint64_t ret_ref = 0;
27209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27212 ret_ref = (uint64_t)ret_var.inner;
27213 if (ret_var.is_owned) {
27219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27220 LDKFundingCreated this_obj_conv;
27221 this_obj_conv.inner = (void*)(this_obj & (~1));
27222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27224 FundingCreated_free(this_obj_conv);
27227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27228 LDKFundingCreated this_ptr_conv;
27229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27230 this_ptr_conv.is_owned = false;
27231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27232 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27233 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
27237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27238 LDKFundingCreated this_ptr_conv;
27239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27240 this_ptr_conv.is_owned = false;
27241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27242 LDKThirtyTwoBytes val_ref;
27243 CHECK((*env)->GetArrayLength(env, val) == 32);
27244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27245 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
27248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
27249 LDKFundingCreated this_ptr_conv;
27250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27251 this_ptr_conv.is_owned = false;
27252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27253 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27254 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
27258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27259 LDKFundingCreated this_ptr_conv;
27260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27261 this_ptr_conv.is_owned = false;
27262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27263 LDKThirtyTwoBytes val_ref;
27264 CHECK((*env)->GetArrayLength(env, val) == 32);
27265 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27266 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
27269 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
27270 LDKFundingCreated this_ptr_conv;
27271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27272 this_ptr_conv.is_owned = false;
27273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27274 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
27278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27279 LDKFundingCreated this_ptr_conv;
27280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27281 this_ptr_conv.is_owned = false;
27282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27283 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
27286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
27287 LDKFundingCreated this_ptr_conv;
27288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27289 this_ptr_conv.is_owned = false;
27290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27291 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
27292 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
27296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27297 LDKFundingCreated this_ptr_conv;
27298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27299 this_ptr_conv.is_owned = false;
27300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27301 LDKSignature val_ref;
27302 CHECK((*env)->GetArrayLength(env, val) == 64);
27303 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
27304 FundingCreated_set_signature(&this_ptr_conv, val_ref);
27307 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) {
27308 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
27309 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
27310 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
27311 LDKThirtyTwoBytes funding_txid_arg_ref;
27312 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
27313 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
27314 LDKSignature signature_arg_ref;
27315 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
27316 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
27317 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
27318 uint64_t ret_ref = 0;
27319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27322 ret_ref = (uint64_t)ret_var.inner;
27323 if (ret_var.is_owned) {
27329 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
27330 LDKFundingCreated ret_var = FundingCreated_clone(arg);
27331 uint64_t ret_ref = 0;
27332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27335 ret_ref = (uint64_t)ret_var.inner;
27336 if (ret_var.is_owned) {
27341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27342 LDKFundingCreated arg_conv;
27343 arg_conv.inner = (void*)(arg & (~1));
27344 arg_conv.is_owned = false;
27345 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27346 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
27350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27351 LDKFundingCreated orig_conv;
27352 orig_conv.inner = (void*)(orig & (~1));
27353 orig_conv.is_owned = false;
27354 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27355 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
27356 uint64_t ret_ref = 0;
27357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27360 ret_ref = (uint64_t)ret_var.inner;
27361 if (ret_var.is_owned) {
27367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27368 LDKFundingSigned this_obj_conv;
27369 this_obj_conv.inner = (void*)(this_obj & (~1));
27370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27372 FundingSigned_free(this_obj_conv);
27375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27376 LDKFundingSigned this_ptr_conv;
27377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27378 this_ptr_conv.is_owned = false;
27379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27380 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27381 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
27385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27386 LDKFundingSigned this_ptr_conv;
27387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27388 this_ptr_conv.is_owned = false;
27389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27390 LDKThirtyTwoBytes val_ref;
27391 CHECK((*env)->GetArrayLength(env, val) == 32);
27392 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27393 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
27396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
27397 LDKFundingSigned this_ptr_conv;
27398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27399 this_ptr_conv.is_owned = false;
27400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27401 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
27402 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
27406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27407 LDKFundingSigned this_ptr_conv;
27408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27409 this_ptr_conv.is_owned = false;
27410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27411 LDKSignature val_ref;
27412 CHECK((*env)->GetArrayLength(env, val) == 64);
27413 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
27414 FundingSigned_set_signature(&this_ptr_conv, val_ref);
27417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
27418 LDKThirtyTwoBytes channel_id_arg_ref;
27419 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27420 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27421 LDKSignature signature_arg_ref;
27422 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
27423 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
27424 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
27425 uint64_t ret_ref = 0;
27426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27429 ret_ref = (uint64_t)ret_var.inner;
27430 if (ret_var.is_owned) {
27436 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
27437 LDKFundingSigned ret_var = FundingSigned_clone(arg);
27438 uint64_t ret_ref = 0;
27439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27442 ret_ref = (uint64_t)ret_var.inner;
27443 if (ret_var.is_owned) {
27448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27449 LDKFundingSigned arg_conv;
27450 arg_conv.inner = (void*)(arg & (~1));
27451 arg_conv.is_owned = false;
27452 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27453 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
27457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27458 LDKFundingSigned orig_conv;
27459 orig_conv.inner = (void*)(orig & (~1));
27460 orig_conv.is_owned = false;
27461 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27462 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
27463 uint64_t ret_ref = 0;
27464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27467 ret_ref = (uint64_t)ret_var.inner;
27468 if (ret_var.is_owned) {
27474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27475 LDKFundingLocked this_obj_conv;
27476 this_obj_conv.inner = (void*)(this_obj & (~1));
27477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27479 FundingLocked_free(this_obj_conv);
27482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27483 LDKFundingLocked this_ptr_conv;
27484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27485 this_ptr_conv.is_owned = false;
27486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27487 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27488 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
27492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27493 LDKFundingLocked this_ptr_conv;
27494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27495 this_ptr_conv.is_owned = false;
27496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27497 LDKThirtyTwoBytes val_ref;
27498 CHECK((*env)->GetArrayLength(env, val) == 32);
27499 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27500 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
27503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27504 LDKFundingLocked this_ptr_conv;
27505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27506 this_ptr_conv.is_owned = false;
27507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27508 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27509 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
27513 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) {
27514 LDKFundingLocked this_ptr_conv;
27515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27516 this_ptr_conv.is_owned = false;
27517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27518 LDKPublicKey val_ref;
27519 CHECK((*env)->GetArrayLength(env, val) == 33);
27520 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27521 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
27524 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) {
27525 LDKThirtyTwoBytes channel_id_arg_ref;
27526 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27527 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27528 LDKPublicKey next_per_commitment_point_arg_ref;
27529 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
27530 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
27531 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
27532 uint64_t ret_ref = 0;
27533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27536 ret_ref = (uint64_t)ret_var.inner;
27537 if (ret_var.is_owned) {
27543 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
27544 LDKFundingLocked ret_var = FundingLocked_clone(arg);
27545 uint64_t ret_ref = 0;
27546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27549 ret_ref = (uint64_t)ret_var.inner;
27550 if (ret_var.is_owned) {
27555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27556 LDKFundingLocked arg_conv;
27557 arg_conv.inner = (void*)(arg & (~1));
27558 arg_conv.is_owned = false;
27559 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27560 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
27564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27565 LDKFundingLocked orig_conv;
27566 orig_conv.inner = (void*)(orig & (~1));
27567 orig_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27569 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
27570 uint64_t ret_ref = 0;
27571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27574 ret_ref = (uint64_t)ret_var.inner;
27575 if (ret_var.is_owned) {
27581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27582 LDKShutdown this_obj_conv;
27583 this_obj_conv.inner = (void*)(this_obj & (~1));
27584 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27586 Shutdown_free(this_obj_conv);
27589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27590 LDKShutdown this_ptr_conv;
27591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27592 this_ptr_conv.is_owned = false;
27593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27594 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27595 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
27599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27600 LDKShutdown this_ptr_conv;
27601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27602 this_ptr_conv.is_owned = false;
27603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27604 LDKThirtyTwoBytes val_ref;
27605 CHECK((*env)->GetArrayLength(env, val) == 32);
27606 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27607 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
27610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27611 LDKShutdown this_ptr_conv;
27612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27613 this_ptr_conv.is_owned = false;
27614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27615 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
27616 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27617 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27622 LDKShutdown this_ptr_conv;
27623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27624 this_ptr_conv.is_owned = false;
27625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27626 LDKCVec_u8Z val_ref;
27627 val_ref.datalen = (*env)->GetArrayLength(env, val);
27628 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27629 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
27630 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
27633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
27634 LDKThirtyTwoBytes channel_id_arg_ref;
27635 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27636 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27637 LDKCVec_u8Z scriptpubkey_arg_ref;
27638 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
27639 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27640 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
27641 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
27642 uint64_t ret_ref = 0;
27643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27646 ret_ref = (uint64_t)ret_var.inner;
27647 if (ret_var.is_owned) {
27653 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
27654 LDKShutdown ret_var = Shutdown_clone(arg);
27655 uint64_t ret_ref = 0;
27656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27659 ret_ref = (uint64_t)ret_var.inner;
27660 if (ret_var.is_owned) {
27665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27666 LDKShutdown arg_conv;
27667 arg_conv.inner = (void*)(arg & (~1));
27668 arg_conv.is_owned = false;
27669 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27670 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
27674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27675 LDKShutdown orig_conv;
27676 orig_conv.inner = (void*)(orig & (~1));
27677 orig_conv.is_owned = false;
27678 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27679 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
27680 uint64_t ret_ref = 0;
27681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27684 ret_ref = (uint64_t)ret_var.inner;
27685 if (ret_var.is_owned) {
27691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27692 LDKClosingSignedFeeRange this_obj_conv;
27693 this_obj_conv.inner = (void*)(this_obj & (~1));
27694 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27696 ClosingSignedFeeRange_free(this_obj_conv);
27699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27700 LDKClosingSignedFeeRange this_ptr_conv;
27701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27702 this_ptr_conv.is_owned = false;
27703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27704 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
27708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27709 LDKClosingSignedFeeRange this_ptr_conv;
27710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27711 this_ptr_conv.is_owned = false;
27712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27713 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
27716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27717 LDKClosingSignedFeeRange this_ptr_conv;
27718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27719 this_ptr_conv.is_owned = false;
27720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27721 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
27725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27726 LDKClosingSignedFeeRange this_ptr_conv;
27727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27728 this_ptr_conv.is_owned = false;
27729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27730 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
27733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
27734 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
27735 uint64_t ret_ref = 0;
27736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27739 ret_ref = (uint64_t)ret_var.inner;
27740 if (ret_var.is_owned) {
27746 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
27747 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
27748 uint64_t ret_ref = 0;
27749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27752 ret_ref = (uint64_t)ret_var.inner;
27753 if (ret_var.is_owned) {
27758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27759 LDKClosingSignedFeeRange arg_conv;
27760 arg_conv.inner = (void*)(arg & (~1));
27761 arg_conv.is_owned = false;
27762 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27763 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
27767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27768 LDKClosingSignedFeeRange orig_conv;
27769 orig_conv.inner = (void*)(orig & (~1));
27770 orig_conv.is_owned = false;
27771 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27772 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
27773 uint64_t ret_ref = 0;
27774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27777 ret_ref = (uint64_t)ret_var.inner;
27778 if (ret_var.is_owned) {
27784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27785 LDKClosingSigned this_obj_conv;
27786 this_obj_conv.inner = (void*)(this_obj & (~1));
27787 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27789 ClosingSigned_free(this_obj_conv);
27792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27793 LDKClosingSigned this_ptr_conv;
27794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27795 this_ptr_conv.is_owned = false;
27796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
27802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27803 LDKClosingSigned this_ptr_conv;
27804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27805 this_ptr_conv.is_owned = false;
27806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27807 LDKThirtyTwoBytes val_ref;
27808 CHECK((*env)->GetArrayLength(env, val) == 32);
27809 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27810 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
27813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27814 LDKClosingSigned this_ptr_conv;
27815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27816 this_ptr_conv.is_owned = false;
27817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27818 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
27822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27823 LDKClosingSigned this_ptr_conv;
27824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27825 this_ptr_conv.is_owned = false;
27826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27827 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
27830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
27831 LDKClosingSigned this_ptr_conv;
27832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27833 this_ptr_conv.is_owned = false;
27834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27835 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
27836 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
27840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27841 LDKClosingSigned this_ptr_conv;
27842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27843 this_ptr_conv.is_owned = false;
27844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27845 LDKSignature val_ref;
27846 CHECK((*env)->GetArrayLength(env, val) == 64);
27847 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
27848 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
27851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
27852 LDKClosingSigned this_ptr_conv;
27853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27854 this_ptr_conv.is_owned = false;
27855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27856 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
27857 uint64_t ret_ref = 0;
27858 if ((uint64_t)ret_var.inner > 4096) {
27859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27862 ret_ref = (uint64_t)ret_var.inner;
27863 if (ret_var.is_owned) {
27870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27871 LDKClosingSigned this_ptr_conv;
27872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27873 this_ptr_conv.is_owned = false;
27874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27875 LDKClosingSignedFeeRange val_conv;
27876 val_conv.inner = (void*)(val & (~1));
27877 val_conv.is_owned = (val & 1) || (val == 0);
27878 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27879 val_conv = ClosingSignedFeeRange_clone(&val_conv);
27880 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
27883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
27884 LDKThirtyTwoBytes channel_id_arg_ref;
27885 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27886 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27887 LDKSignature signature_arg_ref;
27888 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
27889 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
27890 LDKClosingSignedFeeRange fee_range_arg_conv;
27891 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
27892 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
27893 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
27894 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
27895 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
27896 uint64_t ret_ref = 0;
27897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27900 ret_ref = (uint64_t)ret_var.inner;
27901 if (ret_var.is_owned) {
27907 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
27908 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
27909 uint64_t ret_ref = 0;
27910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27913 ret_ref = (uint64_t)ret_var.inner;
27914 if (ret_var.is_owned) {
27919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27920 LDKClosingSigned arg_conv;
27921 arg_conv.inner = (void*)(arg & (~1));
27922 arg_conv.is_owned = false;
27923 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27924 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
27928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27929 LDKClosingSigned orig_conv;
27930 orig_conv.inner = (void*)(orig & (~1));
27931 orig_conv.is_owned = false;
27932 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27933 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
27934 uint64_t ret_ref = 0;
27935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27938 ret_ref = (uint64_t)ret_var.inner;
27939 if (ret_var.is_owned) {
27945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27946 LDKUpdateAddHTLC this_obj_conv;
27947 this_obj_conv.inner = (void*)(this_obj & (~1));
27948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27950 UpdateAddHTLC_free(this_obj_conv);
27953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27954 LDKUpdateAddHTLC this_ptr_conv;
27955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27956 this_ptr_conv.is_owned = false;
27957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27958 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
27963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27964 LDKUpdateAddHTLC this_ptr_conv;
27965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27966 this_ptr_conv.is_owned = false;
27967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27968 LDKThirtyTwoBytes val_ref;
27969 CHECK((*env)->GetArrayLength(env, val) == 32);
27970 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27971 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
27974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27975 LDKUpdateAddHTLC this_ptr_conv;
27976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27977 this_ptr_conv.is_owned = false;
27978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27979 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
27983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27984 LDKUpdateAddHTLC this_ptr_conv;
27985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27986 this_ptr_conv.is_owned = false;
27987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27988 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
27991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27992 LDKUpdateAddHTLC this_ptr_conv;
27993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27994 this_ptr_conv.is_owned = false;
27995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27996 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
28000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28001 LDKUpdateAddHTLC this_ptr_conv;
28002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28003 this_ptr_conv.is_owned = false;
28004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28005 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
28008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
28009 LDKUpdateAddHTLC this_ptr_conv;
28010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28011 this_ptr_conv.is_owned = false;
28012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28013 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28014 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
28018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28019 LDKUpdateAddHTLC this_ptr_conv;
28020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28021 this_ptr_conv.is_owned = false;
28022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28023 LDKThirtyTwoBytes val_ref;
28024 CHECK((*env)->GetArrayLength(env, val) == 32);
28025 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28026 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
28029 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
28030 LDKUpdateAddHTLC this_ptr_conv;
28031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28032 this_ptr_conv.is_owned = false;
28033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28034 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
28038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28039 LDKUpdateAddHTLC this_ptr_conv;
28040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28041 this_ptr_conv.is_owned = false;
28042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28043 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
28046 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
28047 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
28048 uint64_t ret_ref = 0;
28049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28052 ret_ref = (uint64_t)ret_var.inner;
28053 if (ret_var.is_owned) {
28058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28059 LDKUpdateAddHTLC arg_conv;
28060 arg_conv.inner = (void*)(arg & (~1));
28061 arg_conv.is_owned = false;
28062 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28063 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
28067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28068 LDKUpdateAddHTLC orig_conv;
28069 orig_conv.inner = (void*)(orig & (~1));
28070 orig_conv.is_owned = false;
28071 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28072 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
28073 uint64_t ret_ref = 0;
28074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28077 ret_ref = (uint64_t)ret_var.inner;
28078 if (ret_var.is_owned) {
28084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28085 LDKUpdateFulfillHTLC this_obj_conv;
28086 this_obj_conv.inner = (void*)(this_obj & (~1));
28087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28089 UpdateFulfillHTLC_free(this_obj_conv);
28092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28093 LDKUpdateFulfillHTLC this_ptr_conv;
28094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28095 this_ptr_conv.is_owned = false;
28096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28097 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
28102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28103 LDKUpdateFulfillHTLC this_ptr_conv;
28104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28105 this_ptr_conv.is_owned = false;
28106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28107 LDKThirtyTwoBytes val_ref;
28108 CHECK((*env)->GetArrayLength(env, val) == 32);
28109 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28110 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
28113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28114 LDKUpdateFulfillHTLC this_ptr_conv;
28115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28116 this_ptr_conv.is_owned = false;
28117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28118 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
28122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28123 LDKUpdateFulfillHTLC this_ptr_conv;
28124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28125 this_ptr_conv.is_owned = false;
28126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28127 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
28130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
28131 LDKUpdateFulfillHTLC this_ptr_conv;
28132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28133 this_ptr_conv.is_owned = false;
28134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28135 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
28140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28141 LDKUpdateFulfillHTLC this_ptr_conv;
28142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28143 this_ptr_conv.is_owned = false;
28144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28145 LDKThirtyTwoBytes val_ref;
28146 CHECK((*env)->GetArrayLength(env, val) == 32);
28147 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28148 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
28151 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) {
28152 LDKThirtyTwoBytes channel_id_arg_ref;
28153 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28154 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28155 LDKThirtyTwoBytes payment_preimage_arg_ref;
28156 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
28157 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
28158 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
28159 uint64_t ret_ref = 0;
28160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28163 ret_ref = (uint64_t)ret_var.inner;
28164 if (ret_var.is_owned) {
28170 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
28171 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
28172 uint64_t ret_ref = 0;
28173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28176 ret_ref = (uint64_t)ret_var.inner;
28177 if (ret_var.is_owned) {
28182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28183 LDKUpdateFulfillHTLC arg_conv;
28184 arg_conv.inner = (void*)(arg & (~1));
28185 arg_conv.is_owned = false;
28186 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28187 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
28191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28192 LDKUpdateFulfillHTLC orig_conv;
28193 orig_conv.inner = (void*)(orig & (~1));
28194 orig_conv.is_owned = false;
28195 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28196 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
28197 uint64_t ret_ref = 0;
28198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28201 ret_ref = (uint64_t)ret_var.inner;
28202 if (ret_var.is_owned) {
28208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28209 LDKUpdateFailHTLC this_obj_conv;
28210 this_obj_conv.inner = (void*)(this_obj & (~1));
28211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28213 UpdateFailHTLC_free(this_obj_conv);
28216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28217 LDKUpdateFailHTLC this_ptr_conv;
28218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28219 this_ptr_conv.is_owned = false;
28220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28221 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28222 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
28226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28227 LDKUpdateFailHTLC this_ptr_conv;
28228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28229 this_ptr_conv.is_owned = false;
28230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28231 LDKThirtyTwoBytes val_ref;
28232 CHECK((*env)->GetArrayLength(env, val) == 32);
28233 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28234 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
28237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28238 LDKUpdateFailHTLC this_ptr_conv;
28239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28240 this_ptr_conv.is_owned = false;
28241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28242 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
28246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28247 LDKUpdateFailHTLC this_ptr_conv;
28248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28249 this_ptr_conv.is_owned = false;
28250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28251 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
28254 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
28255 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
28256 uint64_t ret_ref = 0;
28257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28260 ret_ref = (uint64_t)ret_var.inner;
28261 if (ret_var.is_owned) {
28266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28267 LDKUpdateFailHTLC arg_conv;
28268 arg_conv.inner = (void*)(arg & (~1));
28269 arg_conv.is_owned = false;
28270 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28271 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
28275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28276 LDKUpdateFailHTLC orig_conv;
28277 orig_conv.inner = (void*)(orig & (~1));
28278 orig_conv.is_owned = false;
28279 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28280 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
28281 uint64_t ret_ref = 0;
28282 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28283 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28285 ret_ref = (uint64_t)ret_var.inner;
28286 if (ret_var.is_owned) {
28292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28293 LDKUpdateFailMalformedHTLC this_obj_conv;
28294 this_obj_conv.inner = (void*)(this_obj & (~1));
28295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28297 UpdateFailMalformedHTLC_free(this_obj_conv);
28300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28301 LDKUpdateFailMalformedHTLC this_ptr_conv;
28302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28303 this_ptr_conv.is_owned = false;
28304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28305 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28306 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
28310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28311 LDKUpdateFailMalformedHTLC this_ptr_conv;
28312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28313 this_ptr_conv.is_owned = false;
28314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28315 LDKThirtyTwoBytes val_ref;
28316 CHECK((*env)->GetArrayLength(env, val) == 32);
28317 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28318 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
28321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28322 LDKUpdateFailMalformedHTLC this_ptr_conv;
28323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28324 this_ptr_conv.is_owned = false;
28325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28326 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
28330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28331 LDKUpdateFailMalformedHTLC this_ptr_conv;
28332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28333 this_ptr_conv.is_owned = false;
28334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28335 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
28338 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
28339 LDKUpdateFailMalformedHTLC this_ptr_conv;
28340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28341 this_ptr_conv.is_owned = false;
28342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28343 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
28347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28348 LDKUpdateFailMalformedHTLC this_ptr_conv;
28349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28350 this_ptr_conv.is_owned = false;
28351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28352 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
28355 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
28356 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
28357 uint64_t ret_ref = 0;
28358 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28359 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28361 ret_ref = (uint64_t)ret_var.inner;
28362 if (ret_var.is_owned) {
28367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28368 LDKUpdateFailMalformedHTLC arg_conv;
28369 arg_conv.inner = (void*)(arg & (~1));
28370 arg_conv.is_owned = false;
28371 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28372 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
28376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28377 LDKUpdateFailMalformedHTLC orig_conv;
28378 orig_conv.inner = (void*)(orig & (~1));
28379 orig_conv.is_owned = false;
28380 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28381 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
28382 uint64_t ret_ref = 0;
28383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28386 ret_ref = (uint64_t)ret_var.inner;
28387 if (ret_var.is_owned) {
28393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28394 LDKCommitmentSigned this_obj_conv;
28395 this_obj_conv.inner = (void*)(this_obj & (~1));
28396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28398 CommitmentSigned_free(this_obj_conv);
28401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28402 LDKCommitmentSigned this_ptr_conv;
28403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28404 this_ptr_conv.is_owned = false;
28405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28406 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
28411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28412 LDKCommitmentSigned this_ptr_conv;
28413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28414 this_ptr_conv.is_owned = false;
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28416 LDKThirtyTwoBytes val_ref;
28417 CHECK((*env)->GetArrayLength(env, val) == 32);
28418 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28419 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
28422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
28423 LDKCommitmentSigned this_ptr_conv;
28424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28425 this_ptr_conv.is_owned = false;
28426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28427 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28428 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
28432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28433 LDKCommitmentSigned this_ptr_conv;
28434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28435 this_ptr_conv.is_owned = false;
28436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28437 LDKSignature val_ref;
28438 CHECK((*env)->GetArrayLength(env, val) == 64);
28439 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
28440 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
28443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
28444 LDKCommitmentSigned this_ptr_conv;
28445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28446 this_ptr_conv.is_owned = false;
28447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28448 LDKCVec_SignatureZ val_constr;
28449 val_constr.datalen = (*env)->GetArrayLength(env, val);
28450 if (val_constr.datalen > 0)
28451 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28453 val_constr.data = NULL;
28454 for (size_t i = 0; i < val_constr.datalen; i++) {
28455 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
28456 LDKSignature val_conv_8_ref;
28457 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
28458 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
28459 val_constr.data[i] = val_conv_8_ref;
28461 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
28464 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) {
28465 LDKThirtyTwoBytes channel_id_arg_ref;
28466 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28467 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28468 LDKSignature signature_arg_ref;
28469 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
28470 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
28471 LDKCVec_SignatureZ htlc_signatures_arg_constr;
28472 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
28473 if (htlc_signatures_arg_constr.datalen > 0)
28474 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28476 htlc_signatures_arg_constr.data = NULL;
28477 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
28478 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
28479 LDKSignature htlc_signatures_arg_conv_8_ref;
28480 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
28481 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
28482 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
28484 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
28485 uint64_t ret_ref = 0;
28486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28489 ret_ref = (uint64_t)ret_var.inner;
28490 if (ret_var.is_owned) {
28496 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
28497 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
28498 uint64_t ret_ref = 0;
28499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28502 ret_ref = (uint64_t)ret_var.inner;
28503 if (ret_var.is_owned) {
28508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28509 LDKCommitmentSigned arg_conv;
28510 arg_conv.inner = (void*)(arg & (~1));
28511 arg_conv.is_owned = false;
28512 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28513 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
28517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28518 LDKCommitmentSigned orig_conv;
28519 orig_conv.inner = (void*)(orig & (~1));
28520 orig_conv.is_owned = false;
28521 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28522 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
28523 uint64_t ret_ref = 0;
28524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28527 ret_ref = (uint64_t)ret_var.inner;
28528 if (ret_var.is_owned) {
28534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28535 LDKRevokeAndACK this_obj_conv;
28536 this_obj_conv.inner = (void*)(this_obj & (~1));
28537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28539 RevokeAndACK_free(this_obj_conv);
28542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28543 LDKRevokeAndACK this_ptr_conv;
28544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28545 this_ptr_conv.is_owned = false;
28546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28547 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
28552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28553 LDKRevokeAndACK this_ptr_conv;
28554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28555 this_ptr_conv.is_owned = false;
28556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28557 LDKThirtyTwoBytes val_ref;
28558 CHECK((*env)->GetArrayLength(env, val) == 32);
28559 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28560 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
28563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
28564 LDKRevokeAndACK this_ptr_conv;
28565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28566 this_ptr_conv.is_owned = false;
28567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28568 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28569 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
28573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28574 LDKRevokeAndACK this_ptr_conv;
28575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28576 this_ptr_conv.is_owned = false;
28577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28578 LDKThirtyTwoBytes val_ref;
28579 CHECK((*env)->GetArrayLength(env, val) == 32);
28580 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28581 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
28584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28585 LDKRevokeAndACK this_ptr_conv;
28586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28587 this_ptr_conv.is_owned = false;
28588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28589 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28590 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
28594 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) {
28595 LDKRevokeAndACK this_ptr_conv;
28596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28597 this_ptr_conv.is_owned = false;
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28599 LDKPublicKey val_ref;
28600 CHECK((*env)->GetArrayLength(env, val) == 33);
28601 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28602 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28605 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) {
28606 LDKThirtyTwoBytes channel_id_arg_ref;
28607 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28608 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28609 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
28610 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
28611 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
28612 LDKPublicKey next_per_commitment_point_arg_ref;
28613 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
28614 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
28615 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
28616 uint64_t ret_ref = 0;
28617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28620 ret_ref = (uint64_t)ret_var.inner;
28621 if (ret_var.is_owned) {
28627 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
28628 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
28629 uint64_t ret_ref = 0;
28630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28633 ret_ref = (uint64_t)ret_var.inner;
28634 if (ret_var.is_owned) {
28639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28640 LDKRevokeAndACK arg_conv;
28641 arg_conv.inner = (void*)(arg & (~1));
28642 arg_conv.is_owned = false;
28643 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28644 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
28648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28649 LDKRevokeAndACK orig_conv;
28650 orig_conv.inner = (void*)(orig & (~1));
28651 orig_conv.is_owned = false;
28652 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28653 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
28654 uint64_t ret_ref = 0;
28655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28658 ret_ref = (uint64_t)ret_var.inner;
28659 if (ret_var.is_owned) {
28665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28666 LDKUpdateFee this_obj_conv;
28667 this_obj_conv.inner = (void*)(this_obj & (~1));
28668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28670 UpdateFee_free(this_obj_conv);
28673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28674 LDKUpdateFee this_ptr_conv;
28675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28676 this_ptr_conv.is_owned = false;
28677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28678 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28679 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
28683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28684 LDKUpdateFee this_ptr_conv;
28685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28686 this_ptr_conv.is_owned = false;
28687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28688 LDKThirtyTwoBytes val_ref;
28689 CHECK((*env)->GetArrayLength(env, val) == 32);
28690 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28691 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
28694 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
28695 LDKUpdateFee this_ptr_conv;
28696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28697 this_ptr_conv.is_owned = false;
28698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28699 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
28703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28704 LDKUpdateFee this_ptr_conv;
28705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28706 this_ptr_conv.is_owned = false;
28707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28708 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
28711 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) {
28712 LDKThirtyTwoBytes channel_id_arg_ref;
28713 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28714 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28715 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
28716 uint64_t ret_ref = 0;
28717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28720 ret_ref = (uint64_t)ret_var.inner;
28721 if (ret_var.is_owned) {
28727 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
28728 LDKUpdateFee ret_var = UpdateFee_clone(arg);
28729 uint64_t ret_ref = 0;
28730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28733 ret_ref = (uint64_t)ret_var.inner;
28734 if (ret_var.is_owned) {
28739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28740 LDKUpdateFee arg_conv;
28741 arg_conv.inner = (void*)(arg & (~1));
28742 arg_conv.is_owned = false;
28743 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28744 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
28748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28749 LDKUpdateFee orig_conv;
28750 orig_conv.inner = (void*)(orig & (~1));
28751 orig_conv.is_owned = false;
28752 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28753 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
28754 uint64_t ret_ref = 0;
28755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28758 ret_ref = (uint64_t)ret_var.inner;
28759 if (ret_var.is_owned) {
28765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28766 LDKDataLossProtect this_obj_conv;
28767 this_obj_conv.inner = (void*)(this_obj & (~1));
28768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28770 DataLossProtect_free(this_obj_conv);
28773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
28774 LDKDataLossProtect this_ptr_conv;
28775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28776 this_ptr_conv.is_owned = false;
28777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28778 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
28783 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) {
28784 LDKDataLossProtect this_ptr_conv;
28785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28786 this_ptr_conv.is_owned = false;
28787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28788 LDKThirtyTwoBytes val_ref;
28789 CHECK((*env)->GetArrayLength(env, val) == 32);
28790 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28791 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
28794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28795 LDKDataLossProtect this_ptr_conv;
28796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28797 this_ptr_conv.is_owned = false;
28798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28799 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28800 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
28804 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) {
28805 LDKDataLossProtect this_ptr_conv;
28806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28807 this_ptr_conv.is_owned = false;
28808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28809 LDKPublicKey val_ref;
28810 CHECK((*env)->GetArrayLength(env, val) == 33);
28811 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28812 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
28815 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) {
28816 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
28817 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
28818 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
28819 LDKPublicKey my_current_per_commitment_point_arg_ref;
28820 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
28821 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
28822 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
28823 uint64_t ret_ref = 0;
28824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28827 ret_ref = (uint64_t)ret_var.inner;
28828 if (ret_var.is_owned) {
28834 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
28835 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
28836 uint64_t ret_ref = 0;
28837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28840 ret_ref = (uint64_t)ret_var.inner;
28841 if (ret_var.is_owned) {
28846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28847 LDKDataLossProtect arg_conv;
28848 arg_conv.inner = (void*)(arg & (~1));
28849 arg_conv.is_owned = false;
28850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28851 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
28855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28856 LDKDataLossProtect orig_conv;
28857 orig_conv.inner = (void*)(orig & (~1));
28858 orig_conv.is_owned = false;
28859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28860 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
28861 uint64_t ret_ref = 0;
28862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28865 ret_ref = (uint64_t)ret_var.inner;
28866 if (ret_var.is_owned) {
28872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28873 LDKChannelReestablish this_obj_conv;
28874 this_obj_conv.inner = (void*)(this_obj & (~1));
28875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28877 ChannelReestablish_free(this_obj_conv);
28880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28881 LDKChannelReestablish this_ptr_conv;
28882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28883 this_ptr_conv.is_owned = false;
28884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28885 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28886 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
28890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28891 LDKChannelReestablish this_ptr_conv;
28892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28893 this_ptr_conv.is_owned = false;
28894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28895 LDKThirtyTwoBytes val_ref;
28896 CHECK((*env)->GetArrayLength(env, val) == 32);
28897 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28898 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
28901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
28902 LDKChannelReestablish this_ptr_conv;
28903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28904 this_ptr_conv.is_owned = false;
28905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28906 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
28910 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) {
28911 LDKChannelReestablish this_ptr_conv;
28912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28913 this_ptr_conv.is_owned = false;
28914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28915 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
28918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
28919 LDKChannelReestablish this_ptr_conv;
28920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28921 this_ptr_conv.is_owned = false;
28922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28923 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
28927 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) {
28928 LDKChannelReestablish this_ptr_conv;
28929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28930 this_ptr_conv.is_owned = false;
28931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28932 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
28935 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
28936 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
28937 uint64_t ret_ref = 0;
28938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28941 ret_ref = (uint64_t)ret_var.inner;
28942 if (ret_var.is_owned) {
28947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28948 LDKChannelReestablish arg_conv;
28949 arg_conv.inner = (void*)(arg & (~1));
28950 arg_conv.is_owned = false;
28951 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28952 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
28956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28957 LDKChannelReestablish orig_conv;
28958 orig_conv.inner = (void*)(orig & (~1));
28959 orig_conv.is_owned = false;
28960 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28961 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
28962 uint64_t ret_ref = 0;
28963 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28964 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28966 ret_ref = (uint64_t)ret_var.inner;
28967 if (ret_var.is_owned) {
28973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28974 LDKAnnouncementSignatures this_obj_conv;
28975 this_obj_conv.inner = (void*)(this_obj & (~1));
28976 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28978 AnnouncementSignatures_free(this_obj_conv);
28981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28982 LDKAnnouncementSignatures this_ptr_conv;
28983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28984 this_ptr_conv.is_owned = false;
28985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28986 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28987 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
28991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28992 LDKAnnouncementSignatures this_ptr_conv;
28993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28994 this_ptr_conv.is_owned = false;
28995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28996 LDKThirtyTwoBytes val_ref;
28997 CHECK((*env)->GetArrayLength(env, val) == 32);
28998 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28999 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
29002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29003 LDKAnnouncementSignatures this_ptr_conv;
29004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29005 this_ptr_conv.is_owned = false;
29006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29007 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
29011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29012 LDKAnnouncementSignatures this_ptr_conv;
29013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29014 this_ptr_conv.is_owned = false;
29015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29016 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
29019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
29020 LDKAnnouncementSignatures this_ptr_conv;
29021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29022 this_ptr_conv.is_owned = false;
29023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29024 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
29029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29030 LDKAnnouncementSignatures this_ptr_conv;
29031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29032 this_ptr_conv.is_owned = false;
29033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29034 LDKSignature val_ref;
29035 CHECK((*env)->GetArrayLength(env, val) == 64);
29036 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29037 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
29040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
29041 LDKAnnouncementSignatures this_ptr_conv;
29042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29043 this_ptr_conv.is_owned = false;
29044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29045 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
29050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29051 LDKAnnouncementSignatures this_ptr_conv;
29052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29053 this_ptr_conv.is_owned = false;
29054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29055 LDKSignature val_ref;
29056 CHECK((*env)->GetArrayLength(env, val) == 64);
29057 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29058 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
29061 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) {
29062 LDKThirtyTwoBytes channel_id_arg_ref;
29063 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29064 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29065 LDKSignature node_signature_arg_ref;
29066 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
29067 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
29068 LDKSignature bitcoin_signature_arg_ref;
29069 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
29070 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
29071 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
29072 uint64_t ret_ref = 0;
29073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29076 ret_ref = (uint64_t)ret_var.inner;
29077 if (ret_var.is_owned) {
29083 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
29084 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
29085 uint64_t ret_ref = 0;
29086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29089 ret_ref = (uint64_t)ret_var.inner;
29090 if (ret_var.is_owned) {
29095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29096 LDKAnnouncementSignatures arg_conv;
29097 arg_conv.inner = (void*)(arg & (~1));
29098 arg_conv.is_owned = false;
29099 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29100 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
29104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29105 LDKAnnouncementSignatures orig_conv;
29106 orig_conv.inner = (void*)(orig & (~1));
29107 orig_conv.is_owned = false;
29108 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29109 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
29110 uint64_t ret_ref = 0;
29111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29114 ret_ref = (uint64_t)ret_var.inner;
29115 if (ret_var.is_owned) {
29121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29122 if ((this_ptr & 1) != 0) return;
29123 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29124 CHECK_ACCESS(this_ptr_ptr);
29125 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
29126 FREE((void*)this_ptr);
29127 NetAddress_free(this_ptr_conv);
29130 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
29131 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29132 *ret_copy = NetAddress_clone(arg);
29133 uint64_t ret_ref = (uint64_t)ret_copy;
29136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29137 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
29138 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
29142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29143 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
29144 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29145 *ret_copy = NetAddress_clone(orig_conv);
29146 uint64_t ret_ref = (uint64_t)ret_copy;
29150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
29151 LDKFourBytes addr_ref;
29152 CHECK((*env)->GetArrayLength(env, addr) == 4);
29153 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
29154 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29155 *ret_copy = NetAddress_ipv4(addr_ref, port);
29156 uint64_t ret_ref = (uint64_t)ret_copy;
29160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
29161 LDKSixteenBytes addr_ref;
29162 CHECK((*env)->GetArrayLength(env, addr) == 16);
29163 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
29164 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29165 *ret_copy = NetAddress_ipv6(addr_ref, port);
29166 uint64_t ret_ref = (uint64_t)ret_copy;
29170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
29171 LDKTwelveBytes a_ref;
29172 CHECK((*env)->GetArrayLength(env, a) == 12);
29173 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
29174 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29175 *ret_copy = NetAddress_onion_v2(a_ref);
29176 uint64_t ret_ref = (uint64_t)ret_copy;
29180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
29181 LDKThirtyTwoBytes ed25519_pubkey_ref;
29182 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
29183 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
29184 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29185 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
29186 uint64_t ret_ref = (uint64_t)ret_copy;
29190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
29191 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
29192 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
29193 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29194 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29195 CVec_u8Z_free(ret_var);
29199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29200 LDKu8slice ser_ref;
29201 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29202 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29203 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
29204 *ret_conv = NetAddress_read(ser_ref);
29205 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29206 return (uint64_t)ret_conv;
29209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29210 LDKUnsignedNodeAnnouncement this_obj_conv;
29211 this_obj_conv.inner = (void*)(this_obj & (~1));
29212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29214 UnsignedNodeAnnouncement_free(this_obj_conv);
29217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29218 LDKUnsignedNodeAnnouncement this_ptr_conv;
29219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29220 this_ptr_conv.is_owned = false;
29221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29222 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
29223 uint64_t ret_ref = 0;
29224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29227 ret_ref = (uint64_t)ret_var.inner;
29228 if (ret_var.is_owned) {
29234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29235 LDKUnsignedNodeAnnouncement this_ptr_conv;
29236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29237 this_ptr_conv.is_owned = false;
29238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29239 LDKNodeFeatures val_conv;
29240 val_conv.inner = (void*)(val & (~1));
29241 val_conv.is_owned = (val & 1) || (val == 0);
29242 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29243 val_conv = NodeFeatures_clone(&val_conv);
29244 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
29247 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
29248 LDKUnsignedNodeAnnouncement this_ptr_conv;
29249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29250 this_ptr_conv.is_owned = false;
29251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29252 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
29256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29257 LDKUnsignedNodeAnnouncement this_ptr_conv;
29258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29259 this_ptr_conv.is_owned = false;
29260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29261 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
29264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29265 LDKUnsignedNodeAnnouncement this_ptr_conv;
29266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29267 this_ptr_conv.is_owned = false;
29268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29269 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29270 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
29274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29275 LDKUnsignedNodeAnnouncement this_ptr_conv;
29276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29277 this_ptr_conv.is_owned = false;
29278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29279 LDKPublicKey val_ref;
29280 CHECK((*env)->GetArrayLength(env, val) == 33);
29281 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29282 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
29285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
29286 LDKUnsignedNodeAnnouncement this_ptr_conv;
29287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29288 this_ptr_conv.is_owned = false;
29289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29290 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
29291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
29295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29296 LDKUnsignedNodeAnnouncement this_ptr_conv;
29297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29298 this_ptr_conv.is_owned = false;
29299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29300 LDKThreeBytes val_ref;
29301 CHECK((*env)->GetArrayLength(env, val) == 3);
29302 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
29303 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
29306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29307 LDKUnsignedNodeAnnouncement this_ptr_conv;
29308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29309 this_ptr_conv.is_owned = false;
29310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29311 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
29316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29317 LDKUnsignedNodeAnnouncement this_ptr_conv;
29318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29319 this_ptr_conv.is_owned = false;
29320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29321 LDKThirtyTwoBytes val_ref;
29322 CHECK((*env)->GetArrayLength(env, val) == 32);
29323 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29324 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
29327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29328 LDKUnsignedNodeAnnouncement this_ptr_conv;
29329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29330 this_ptr_conv.is_owned = false;
29331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29332 LDKCVec_NetAddressZ val_constr;
29333 val_constr.datalen = (*env)->GetArrayLength(env, val);
29334 if (val_constr.datalen > 0)
29335 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29337 val_constr.data = NULL;
29338 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29339 for (size_t m = 0; m < val_constr.datalen; m++) {
29340 int64_t val_conv_12 = val_vals[m];
29341 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
29342 CHECK_ACCESS(val_conv_12_ptr);
29343 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
29344 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
29345 val_constr.data[m] = val_conv_12_conv;
29347 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29348 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
29351 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
29352 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
29353 uint64_t ret_ref = 0;
29354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29357 ret_ref = (uint64_t)ret_var.inner;
29358 if (ret_var.is_owned) {
29363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29364 LDKUnsignedNodeAnnouncement arg_conv;
29365 arg_conv.inner = (void*)(arg & (~1));
29366 arg_conv.is_owned = false;
29367 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29368 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
29372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29373 LDKUnsignedNodeAnnouncement orig_conv;
29374 orig_conv.inner = (void*)(orig & (~1));
29375 orig_conv.is_owned = false;
29376 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29377 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
29378 uint64_t ret_ref = 0;
29379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29382 ret_ref = (uint64_t)ret_var.inner;
29383 if (ret_var.is_owned) {
29389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29390 LDKNodeAnnouncement this_obj_conv;
29391 this_obj_conv.inner = (void*)(this_obj & (~1));
29392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29394 NodeAnnouncement_free(this_obj_conv);
29397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
29398 LDKNodeAnnouncement this_ptr_conv;
29399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29400 this_ptr_conv.is_owned = false;
29401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29402 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29403 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
29407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29408 LDKNodeAnnouncement this_ptr_conv;
29409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29410 this_ptr_conv.is_owned = false;
29411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29412 LDKSignature val_ref;
29413 CHECK((*env)->GetArrayLength(env, val) == 64);
29414 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29415 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
29418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
29419 LDKNodeAnnouncement this_ptr_conv;
29420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29421 this_ptr_conv.is_owned = false;
29422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29423 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
29424 uint64_t ret_ref = 0;
29425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29428 ret_ref = (uint64_t)ret_var.inner;
29429 if (ret_var.is_owned) {
29435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29436 LDKNodeAnnouncement this_ptr_conv;
29437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29438 this_ptr_conv.is_owned = false;
29439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29440 LDKUnsignedNodeAnnouncement val_conv;
29441 val_conv.inner = (void*)(val & (~1));
29442 val_conv.is_owned = (val & 1) || (val == 0);
29443 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29444 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
29445 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
29448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
29449 LDKSignature signature_arg_ref;
29450 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
29451 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
29452 LDKUnsignedNodeAnnouncement contents_arg_conv;
29453 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29454 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29455 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29456 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
29457 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
29458 uint64_t ret_ref = 0;
29459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462 ret_ref = (uint64_t)ret_var.inner;
29463 if (ret_var.is_owned) {
29469 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
29470 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
29471 uint64_t ret_ref = 0;
29472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29475 ret_ref = (uint64_t)ret_var.inner;
29476 if (ret_var.is_owned) {
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29482 LDKNodeAnnouncement arg_conv;
29483 arg_conv.inner = (void*)(arg & (~1));
29484 arg_conv.is_owned = false;
29485 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29486 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
29490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29491 LDKNodeAnnouncement orig_conv;
29492 orig_conv.inner = (void*)(orig & (~1));
29493 orig_conv.is_owned = false;
29494 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29495 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
29496 uint64_t ret_ref = 0;
29497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29500 ret_ref = (uint64_t)ret_var.inner;
29501 if (ret_var.is_owned) {
29507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29508 LDKUnsignedChannelAnnouncement this_obj_conv;
29509 this_obj_conv.inner = (void*)(this_obj & (~1));
29510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29512 UnsignedChannelAnnouncement_free(this_obj_conv);
29515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29516 LDKUnsignedChannelAnnouncement this_ptr_conv;
29517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29518 this_ptr_conv.is_owned = false;
29519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29520 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
29521 uint64_t ret_ref = 0;
29522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29525 ret_ref = (uint64_t)ret_var.inner;
29526 if (ret_var.is_owned) {
29532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29533 LDKUnsignedChannelAnnouncement this_ptr_conv;
29534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29535 this_ptr_conv.is_owned = false;
29536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29537 LDKChannelFeatures val_conv;
29538 val_conv.inner = (void*)(val & (~1));
29539 val_conv.is_owned = (val & 1) || (val == 0);
29540 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29541 val_conv = ChannelFeatures_clone(&val_conv);
29542 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
29545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
29546 LDKUnsignedChannelAnnouncement this_ptr_conv;
29547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29548 this_ptr_conv.is_owned = false;
29549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
29555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29556 LDKUnsignedChannelAnnouncement this_ptr_conv;
29557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29558 this_ptr_conv.is_owned = false;
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29560 LDKThirtyTwoBytes val_ref;
29561 CHECK((*env)->GetArrayLength(env, val) == 32);
29562 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29563 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
29566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29567 LDKUnsignedChannelAnnouncement this_ptr_conv;
29568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29569 this_ptr_conv.is_owned = false;
29570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29571 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
29575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29576 LDKUnsignedChannelAnnouncement this_ptr_conv;
29577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29578 this_ptr_conv.is_owned = false;
29579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29580 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
29583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
29584 LDKUnsignedChannelAnnouncement this_ptr_conv;
29585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29586 this_ptr_conv.is_owned = false;
29587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29588 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
29593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29594 LDKUnsignedChannelAnnouncement this_ptr_conv;
29595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29596 this_ptr_conv.is_owned = false;
29597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29598 LDKPublicKey val_ref;
29599 CHECK((*env)->GetArrayLength(env, val) == 33);
29600 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29601 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
29604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
29605 LDKUnsignedChannelAnnouncement this_ptr_conv;
29606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29607 this_ptr_conv.is_owned = false;
29608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29609 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29610 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
29614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29615 LDKUnsignedChannelAnnouncement this_ptr_conv;
29616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29617 this_ptr_conv.is_owned = false;
29618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29619 LDKPublicKey val_ref;
29620 CHECK((*env)->GetArrayLength(env, val) == 33);
29621 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29622 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
29625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
29626 LDKUnsignedChannelAnnouncement this_ptr_conv;
29627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29628 this_ptr_conv.is_owned = false;
29629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29630 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
29635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29636 LDKUnsignedChannelAnnouncement this_ptr_conv;
29637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29638 this_ptr_conv.is_owned = false;
29639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29640 LDKPublicKey val_ref;
29641 CHECK((*env)->GetArrayLength(env, val) == 33);
29642 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29643 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
29646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
29647 LDKUnsignedChannelAnnouncement this_ptr_conv;
29648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29649 this_ptr_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29651 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29652 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
29656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29657 LDKUnsignedChannelAnnouncement this_ptr_conv;
29658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29659 this_ptr_conv.is_owned = false;
29660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29661 LDKPublicKey val_ref;
29662 CHECK((*env)->GetArrayLength(env, val) == 33);
29663 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29664 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
29667 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
29668 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
29669 uint64_t ret_ref = 0;
29670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29673 ret_ref = (uint64_t)ret_var.inner;
29674 if (ret_var.is_owned) {
29679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29680 LDKUnsignedChannelAnnouncement arg_conv;
29681 arg_conv.inner = (void*)(arg & (~1));
29682 arg_conv.is_owned = false;
29683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29684 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
29688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29689 LDKUnsignedChannelAnnouncement orig_conv;
29690 orig_conv.inner = (void*)(orig & (~1));
29691 orig_conv.is_owned = false;
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29693 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
29694 uint64_t ret_ref = 0;
29695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29698 ret_ref = (uint64_t)ret_var.inner;
29699 if (ret_var.is_owned) {
29705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29706 LDKChannelAnnouncement this_obj_conv;
29707 this_obj_conv.inner = (void*)(this_obj & (~1));
29708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29710 ChannelAnnouncement_free(this_obj_conv);
29713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
29714 LDKChannelAnnouncement this_ptr_conv;
29715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29716 this_ptr_conv.is_owned = false;
29717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29718 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29719 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
29723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29724 LDKChannelAnnouncement this_ptr_conv;
29725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29726 this_ptr_conv.is_owned = false;
29727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29728 LDKSignature val_ref;
29729 CHECK((*env)->GetArrayLength(env, val) == 64);
29730 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29731 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
29734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
29735 LDKChannelAnnouncement this_ptr_conv;
29736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29737 this_ptr_conv.is_owned = false;
29738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29739 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29740 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
29744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29745 LDKChannelAnnouncement this_ptr_conv;
29746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29747 this_ptr_conv.is_owned = false;
29748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29749 LDKSignature val_ref;
29750 CHECK((*env)->GetArrayLength(env, val) == 64);
29751 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29752 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
29755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
29756 LDKChannelAnnouncement this_ptr_conv;
29757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29758 this_ptr_conv.is_owned = false;
29759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29760 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
29765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29766 LDKChannelAnnouncement this_ptr_conv;
29767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29768 this_ptr_conv.is_owned = false;
29769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29770 LDKSignature val_ref;
29771 CHECK((*env)->GetArrayLength(env, val) == 64);
29772 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29773 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
29776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
29777 LDKChannelAnnouncement this_ptr_conv;
29778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29779 this_ptr_conv.is_owned = false;
29780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29781 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29782 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
29786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29787 LDKChannelAnnouncement this_ptr_conv;
29788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29789 this_ptr_conv.is_owned = false;
29790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29791 LDKSignature val_ref;
29792 CHECK((*env)->GetArrayLength(env, val) == 64);
29793 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29794 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
29797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
29798 LDKChannelAnnouncement this_ptr_conv;
29799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29800 this_ptr_conv.is_owned = false;
29801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
29803 uint64_t ret_ref = 0;
29804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29807 ret_ref = (uint64_t)ret_var.inner;
29808 if (ret_var.is_owned) {
29814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29815 LDKChannelAnnouncement this_ptr_conv;
29816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29817 this_ptr_conv.is_owned = false;
29818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29819 LDKUnsignedChannelAnnouncement val_conv;
29820 val_conv.inner = (void*)(val & (~1));
29821 val_conv.is_owned = (val & 1) || (val == 0);
29822 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29823 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
29824 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
29827 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) {
29828 LDKSignature node_signature_1_arg_ref;
29829 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
29830 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
29831 LDKSignature node_signature_2_arg_ref;
29832 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
29833 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
29834 LDKSignature bitcoin_signature_1_arg_ref;
29835 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
29836 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
29837 LDKSignature bitcoin_signature_2_arg_ref;
29838 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
29839 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
29840 LDKUnsignedChannelAnnouncement contents_arg_conv;
29841 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29842 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29843 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29844 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
29845 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);
29846 uint64_t ret_ref = 0;
29847 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29848 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29850 ret_ref = (uint64_t)ret_var.inner;
29851 if (ret_var.is_owned) {
29857 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
29858 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
29859 uint64_t ret_ref = 0;
29860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29863 ret_ref = (uint64_t)ret_var.inner;
29864 if (ret_var.is_owned) {
29869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29870 LDKChannelAnnouncement arg_conv;
29871 arg_conv.inner = (void*)(arg & (~1));
29872 arg_conv.is_owned = false;
29873 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29874 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
29878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29879 LDKChannelAnnouncement orig_conv;
29880 orig_conv.inner = (void*)(orig & (~1));
29881 orig_conv.is_owned = false;
29882 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29883 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
29884 uint64_t ret_ref = 0;
29885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29888 ret_ref = (uint64_t)ret_var.inner;
29889 if (ret_var.is_owned) {
29895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29896 LDKUnsignedChannelUpdate this_obj_conv;
29897 this_obj_conv.inner = (void*)(this_obj & (~1));
29898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29900 UnsignedChannelUpdate_free(this_obj_conv);
29903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
29904 LDKUnsignedChannelUpdate this_ptr_conv;
29905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29906 this_ptr_conv.is_owned = false;
29907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29908 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29909 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
29913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29914 LDKUnsignedChannelUpdate this_ptr_conv;
29915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29916 this_ptr_conv.is_owned = false;
29917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29918 LDKThirtyTwoBytes val_ref;
29919 CHECK((*env)->GetArrayLength(env, val) == 32);
29920 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29921 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
29924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29925 LDKUnsignedChannelUpdate this_ptr_conv;
29926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29927 this_ptr_conv.is_owned = false;
29928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29929 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
29933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29934 LDKUnsignedChannelUpdate this_ptr_conv;
29935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29936 this_ptr_conv.is_owned = false;
29937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29938 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
29941 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
29942 LDKUnsignedChannelUpdate this_ptr_conv;
29943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29944 this_ptr_conv.is_owned = false;
29945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29946 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
29950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29951 LDKUnsignedChannelUpdate this_ptr_conv;
29952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29953 this_ptr_conv.is_owned = false;
29954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29955 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
29958 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
29959 LDKUnsignedChannelUpdate this_ptr_conv;
29960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29961 this_ptr_conv.is_owned = false;
29962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29963 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
29967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
29968 LDKUnsignedChannelUpdate this_ptr_conv;
29969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29970 this_ptr_conv.is_owned = false;
29971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29972 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
29975 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29976 LDKUnsignedChannelUpdate this_ptr_conv;
29977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29978 this_ptr_conv.is_owned = false;
29979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29980 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
29984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29985 LDKUnsignedChannelUpdate this_ptr_conv;
29986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29987 this_ptr_conv.is_owned = false;
29988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29989 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
29992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29993 LDKUnsignedChannelUpdate this_ptr_conv;
29994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29995 this_ptr_conv.is_owned = false;
29996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29997 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
30001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30002 LDKUnsignedChannelUpdate this_ptr_conv;
30003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30004 this_ptr_conv.is_owned = false;
30005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30006 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
30009 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30010 LDKUnsignedChannelUpdate this_ptr_conv;
30011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30012 this_ptr_conv.is_owned = false;
30013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30014 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
30018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30019 LDKUnsignedChannelUpdate this_ptr_conv;
30020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30021 this_ptr_conv.is_owned = false;
30022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30023 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
30026 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
30027 LDKUnsignedChannelUpdate this_ptr_conv;
30028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30029 this_ptr_conv.is_owned = false;
30030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30031 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
30035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30036 LDKUnsignedChannelUpdate this_ptr_conv;
30037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30038 this_ptr_conv.is_owned = false;
30039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30040 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
30043 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
30044 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
30045 uint64_t ret_ref = 0;
30046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30049 ret_ref = (uint64_t)ret_var.inner;
30050 if (ret_var.is_owned) {
30055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30056 LDKUnsignedChannelUpdate arg_conv;
30057 arg_conv.inner = (void*)(arg & (~1));
30058 arg_conv.is_owned = false;
30059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30060 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
30064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30065 LDKUnsignedChannelUpdate orig_conv;
30066 orig_conv.inner = (void*)(orig & (~1));
30067 orig_conv.is_owned = false;
30068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30069 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
30070 uint64_t ret_ref = 0;
30071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30074 ret_ref = (uint64_t)ret_var.inner;
30075 if (ret_var.is_owned) {
30081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30082 LDKChannelUpdate this_obj_conv;
30083 this_obj_conv.inner = (void*)(this_obj & (~1));
30084 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30086 ChannelUpdate_free(this_obj_conv);
30089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30090 LDKChannelUpdate this_ptr_conv;
30091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30092 this_ptr_conv.is_owned = false;
30093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30094 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30095 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
30099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30100 LDKChannelUpdate this_ptr_conv;
30101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30102 this_ptr_conv.is_owned = false;
30103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30104 LDKSignature val_ref;
30105 CHECK((*env)->GetArrayLength(env, val) == 64);
30106 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30107 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
30110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
30111 LDKChannelUpdate this_ptr_conv;
30112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30113 this_ptr_conv.is_owned = false;
30114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30115 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
30116 uint64_t ret_ref = 0;
30117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30120 ret_ref = (uint64_t)ret_var.inner;
30121 if (ret_var.is_owned) {
30127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30128 LDKChannelUpdate this_ptr_conv;
30129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30130 this_ptr_conv.is_owned = false;
30131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30132 LDKUnsignedChannelUpdate val_conv;
30133 val_conv.inner = (void*)(val & (~1));
30134 val_conv.is_owned = (val & 1) || (val == 0);
30135 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30136 val_conv = UnsignedChannelUpdate_clone(&val_conv);
30137 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
30140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
30141 LDKSignature signature_arg_ref;
30142 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30143 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30144 LDKUnsignedChannelUpdate contents_arg_conv;
30145 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30146 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30147 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30148 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
30149 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
30150 uint64_t ret_ref = 0;
30151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30154 ret_ref = (uint64_t)ret_var.inner;
30155 if (ret_var.is_owned) {
30161 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
30162 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
30163 uint64_t ret_ref = 0;
30164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30167 ret_ref = (uint64_t)ret_var.inner;
30168 if (ret_var.is_owned) {
30173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30174 LDKChannelUpdate arg_conv;
30175 arg_conv.inner = (void*)(arg & (~1));
30176 arg_conv.is_owned = false;
30177 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30178 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
30182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30183 LDKChannelUpdate orig_conv;
30184 orig_conv.inner = (void*)(orig & (~1));
30185 orig_conv.is_owned = false;
30186 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30187 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
30188 uint64_t ret_ref = 0;
30189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30192 ret_ref = (uint64_t)ret_var.inner;
30193 if (ret_var.is_owned) {
30199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30200 LDKQueryChannelRange this_obj_conv;
30201 this_obj_conv.inner = (void*)(this_obj & (~1));
30202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30204 QueryChannelRange_free(this_obj_conv);
30207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30208 LDKQueryChannelRange this_ptr_conv;
30209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30210 this_ptr_conv.is_owned = false;
30211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30212 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30213 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
30217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30218 LDKQueryChannelRange this_ptr_conv;
30219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30220 this_ptr_conv.is_owned = false;
30221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30222 LDKThirtyTwoBytes val_ref;
30223 CHECK((*env)->GetArrayLength(env, val) == 32);
30224 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30225 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
30228 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
30229 LDKQueryChannelRange this_ptr_conv;
30230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30231 this_ptr_conv.is_owned = false;
30232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30233 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
30237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30238 LDKQueryChannelRange this_ptr_conv;
30239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30240 this_ptr_conv.is_owned = false;
30241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30242 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
30245 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
30246 LDKQueryChannelRange this_ptr_conv;
30247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30248 this_ptr_conv.is_owned = false;
30249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30250 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
30254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30255 LDKQueryChannelRange this_ptr_conv;
30256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30257 this_ptr_conv.is_owned = false;
30258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30259 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
30262 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) {
30263 LDKThirtyTwoBytes chain_hash_arg_ref;
30264 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
30265 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
30266 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
30267 uint64_t ret_ref = 0;
30268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30271 ret_ref = (uint64_t)ret_var.inner;
30272 if (ret_var.is_owned) {
30278 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
30279 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
30280 uint64_t ret_ref = 0;
30281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30284 ret_ref = (uint64_t)ret_var.inner;
30285 if (ret_var.is_owned) {
30290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30291 LDKQueryChannelRange arg_conv;
30292 arg_conv.inner = (void*)(arg & (~1));
30293 arg_conv.is_owned = false;
30294 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30295 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
30299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30300 LDKQueryChannelRange orig_conv;
30301 orig_conv.inner = (void*)(orig & (~1));
30302 orig_conv.is_owned = false;
30303 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30304 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
30305 uint64_t ret_ref = 0;
30306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30309 ret_ref = (uint64_t)ret_var.inner;
30310 if (ret_var.is_owned) {
30316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30317 LDKReplyChannelRange this_obj_conv;
30318 this_obj_conv.inner = (void*)(this_obj & (~1));
30319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30321 ReplyChannelRange_free(this_obj_conv);
30324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30325 LDKReplyChannelRange this_ptr_conv;
30326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30327 this_ptr_conv.is_owned = false;
30328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30329 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30330 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
30334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30335 LDKReplyChannelRange this_ptr_conv;
30336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30337 this_ptr_conv.is_owned = false;
30338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30339 LDKThirtyTwoBytes val_ref;
30340 CHECK((*env)->GetArrayLength(env, val) == 32);
30341 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30342 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
30345 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
30346 LDKReplyChannelRange this_ptr_conv;
30347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30348 this_ptr_conv.is_owned = false;
30349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30350 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
30354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30355 LDKReplyChannelRange this_ptr_conv;
30356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30357 this_ptr_conv.is_owned = false;
30358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30359 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
30362 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
30363 LDKReplyChannelRange this_ptr_conv;
30364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30365 this_ptr_conv.is_owned = false;
30366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30367 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
30371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30372 LDKReplyChannelRange this_ptr_conv;
30373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30374 this_ptr_conv.is_owned = false;
30375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30376 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
30379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
30380 LDKReplyChannelRange this_ptr_conv;
30381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30382 this_ptr_conv.is_owned = false;
30383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30384 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
30388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30389 LDKReplyChannelRange this_ptr_conv;
30390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30391 this_ptr_conv.is_owned = false;
30392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30393 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
30396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30397 LDKReplyChannelRange this_ptr_conv;
30398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30399 this_ptr_conv.is_owned = false;
30400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30401 LDKCVec_u64Z val_constr;
30402 val_constr.datalen = (*env)->GetArrayLength(env, val);
30403 if (val_constr.datalen > 0)
30404 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30406 val_constr.data = NULL;
30407 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30408 for (size_t g = 0; g < val_constr.datalen; g++) {
30409 int64_t val_conv_6 = val_vals[g];
30410 val_constr.data[g] = val_conv_6;
30412 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30413 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
30416 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) {
30417 LDKThirtyTwoBytes chain_hash_arg_ref;
30418 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
30419 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
30420 LDKCVec_u64Z short_channel_ids_arg_constr;
30421 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
30422 if (short_channel_ids_arg_constr.datalen > 0)
30423 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30425 short_channel_ids_arg_constr.data = NULL;
30426 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
30427 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
30428 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
30429 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
30431 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
30432 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
30433 uint64_t ret_ref = 0;
30434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30437 ret_ref = (uint64_t)ret_var.inner;
30438 if (ret_var.is_owned) {
30444 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
30445 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
30446 uint64_t ret_ref = 0;
30447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30450 ret_ref = (uint64_t)ret_var.inner;
30451 if (ret_var.is_owned) {
30456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30457 LDKReplyChannelRange arg_conv;
30458 arg_conv.inner = (void*)(arg & (~1));
30459 arg_conv.is_owned = false;
30460 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30461 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
30465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30466 LDKReplyChannelRange orig_conv;
30467 orig_conv.inner = (void*)(orig & (~1));
30468 orig_conv.is_owned = false;
30469 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30470 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
30471 uint64_t ret_ref = 0;
30472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30475 ret_ref = (uint64_t)ret_var.inner;
30476 if (ret_var.is_owned) {
30482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30483 LDKQueryShortChannelIds this_obj_conv;
30484 this_obj_conv.inner = (void*)(this_obj & (~1));
30485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30487 QueryShortChannelIds_free(this_obj_conv);
30490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30491 LDKQueryShortChannelIds this_ptr_conv;
30492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30493 this_ptr_conv.is_owned = false;
30494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30495 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
30500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30501 LDKQueryShortChannelIds this_ptr_conv;
30502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30503 this_ptr_conv.is_owned = false;
30504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30505 LDKThirtyTwoBytes val_ref;
30506 CHECK((*env)->GetArrayLength(env, val) == 32);
30507 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30508 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
30511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30512 LDKQueryShortChannelIds this_ptr_conv;
30513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30514 this_ptr_conv.is_owned = false;
30515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30516 LDKCVec_u64Z val_constr;
30517 val_constr.datalen = (*env)->GetArrayLength(env, val);
30518 if (val_constr.datalen > 0)
30519 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30521 val_constr.data = NULL;
30522 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30523 for (size_t g = 0; g < val_constr.datalen; g++) {
30524 int64_t val_conv_6 = val_vals[g];
30525 val_constr.data[g] = val_conv_6;
30527 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30528 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
30531 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) {
30532 LDKThirtyTwoBytes chain_hash_arg_ref;
30533 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
30534 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
30535 LDKCVec_u64Z short_channel_ids_arg_constr;
30536 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
30537 if (short_channel_ids_arg_constr.datalen > 0)
30538 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30540 short_channel_ids_arg_constr.data = NULL;
30541 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
30542 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
30543 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
30544 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
30546 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
30547 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
30548 uint64_t ret_ref = 0;
30549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30552 ret_ref = (uint64_t)ret_var.inner;
30553 if (ret_var.is_owned) {
30559 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
30560 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
30561 uint64_t ret_ref = 0;
30562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30565 ret_ref = (uint64_t)ret_var.inner;
30566 if (ret_var.is_owned) {
30571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30572 LDKQueryShortChannelIds arg_conv;
30573 arg_conv.inner = (void*)(arg & (~1));
30574 arg_conv.is_owned = false;
30575 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30576 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
30580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30581 LDKQueryShortChannelIds orig_conv;
30582 orig_conv.inner = (void*)(orig & (~1));
30583 orig_conv.is_owned = false;
30584 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30585 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
30586 uint64_t ret_ref = 0;
30587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30590 ret_ref = (uint64_t)ret_var.inner;
30591 if (ret_var.is_owned) {
30597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30598 LDKReplyShortChannelIdsEnd this_obj_conv;
30599 this_obj_conv.inner = (void*)(this_obj & (~1));
30600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30602 ReplyShortChannelIdsEnd_free(this_obj_conv);
30605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30606 LDKReplyShortChannelIdsEnd this_ptr_conv;
30607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30608 this_ptr_conv.is_owned = false;
30609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30610 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30611 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
30615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30616 LDKReplyShortChannelIdsEnd this_ptr_conv;
30617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30618 this_ptr_conv.is_owned = false;
30619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30620 LDKThirtyTwoBytes val_ref;
30621 CHECK((*env)->GetArrayLength(env, val) == 32);
30622 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30623 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
30626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
30627 LDKReplyShortChannelIdsEnd this_ptr_conv;
30628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30629 this_ptr_conv.is_owned = false;
30630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30631 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
30635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30636 LDKReplyShortChannelIdsEnd this_ptr_conv;
30637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30638 this_ptr_conv.is_owned = false;
30639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30640 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
30643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
30644 LDKThirtyTwoBytes chain_hash_arg_ref;
30645 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
30646 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
30647 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
30648 uint64_t ret_ref = 0;
30649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30652 ret_ref = (uint64_t)ret_var.inner;
30653 if (ret_var.is_owned) {
30659 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
30660 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
30661 uint64_t ret_ref = 0;
30662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30665 ret_ref = (uint64_t)ret_var.inner;
30666 if (ret_var.is_owned) {
30671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30672 LDKReplyShortChannelIdsEnd arg_conv;
30673 arg_conv.inner = (void*)(arg & (~1));
30674 arg_conv.is_owned = false;
30675 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30676 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
30680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30681 LDKReplyShortChannelIdsEnd orig_conv;
30682 orig_conv.inner = (void*)(orig & (~1));
30683 orig_conv.is_owned = false;
30684 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30685 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
30686 uint64_t ret_ref = 0;
30687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30690 ret_ref = (uint64_t)ret_var.inner;
30691 if (ret_var.is_owned) {
30697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30698 LDKGossipTimestampFilter this_obj_conv;
30699 this_obj_conv.inner = (void*)(this_obj & (~1));
30700 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30702 GossipTimestampFilter_free(this_obj_conv);
30705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30706 LDKGossipTimestampFilter this_ptr_conv;
30707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30708 this_ptr_conv.is_owned = false;
30709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30710 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
30715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30716 LDKGossipTimestampFilter this_ptr_conv;
30717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30718 this_ptr_conv.is_owned = false;
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30720 LDKThirtyTwoBytes val_ref;
30721 CHECK((*env)->GetArrayLength(env, val) == 32);
30722 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30723 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
30726 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
30727 LDKGossipTimestampFilter this_ptr_conv;
30728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30729 this_ptr_conv.is_owned = false;
30730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30731 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
30735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30736 LDKGossipTimestampFilter this_ptr_conv;
30737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30738 this_ptr_conv.is_owned = false;
30739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30740 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
30743 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
30744 LDKGossipTimestampFilter this_ptr_conv;
30745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30746 this_ptr_conv.is_owned = false;
30747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30748 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
30752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30753 LDKGossipTimestampFilter this_ptr_conv;
30754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30755 this_ptr_conv.is_owned = false;
30756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30757 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
30760 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) {
30761 LDKThirtyTwoBytes chain_hash_arg_ref;
30762 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
30763 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
30764 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
30765 uint64_t ret_ref = 0;
30766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30769 ret_ref = (uint64_t)ret_var.inner;
30770 if (ret_var.is_owned) {
30776 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
30777 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
30778 uint64_t ret_ref = 0;
30779 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30780 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30782 ret_ref = (uint64_t)ret_var.inner;
30783 if (ret_var.is_owned) {
30788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30789 LDKGossipTimestampFilter arg_conv;
30790 arg_conv.inner = (void*)(arg & (~1));
30791 arg_conv.is_owned = false;
30792 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30793 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
30797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30798 LDKGossipTimestampFilter orig_conv;
30799 orig_conv.inner = (void*)(orig & (~1));
30800 orig_conv.is_owned = false;
30801 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30802 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
30803 uint64_t ret_ref = 0;
30804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30807 ret_ref = (uint64_t)ret_var.inner;
30808 if (ret_var.is_owned) {
30814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30815 if ((this_ptr & 1) != 0) return;
30816 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30817 CHECK_ACCESS(this_ptr_ptr);
30818 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
30819 FREE((void*)this_ptr);
30820 ErrorAction_free(this_ptr_conv);
30823 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
30824 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30825 *ret_copy = ErrorAction_clone(arg);
30826 uint64_t ret_ref = (uint64_t)ret_copy;
30829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30830 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
30831 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
30835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30836 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
30837 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30838 *ret_copy = ErrorAction_clone(orig_conv);
30839 uint64_t ret_ref = (uint64_t)ret_copy;
30843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
30844 LDKErrorMessage msg_conv;
30845 msg_conv.inner = (void*)(msg & (~1));
30846 msg_conv.is_owned = (msg & 1) || (msg == 0);
30847 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30848 msg_conv = ErrorMessage_clone(&msg_conv);
30849 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30850 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
30851 uint64_t ret_ref = (uint64_t)ret_copy;
30855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
30856 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30857 *ret_copy = ErrorAction_ignore_error();
30858 uint64_t ret_ref = (uint64_t)ret_copy;
30862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
30863 LDKLevel a_conv = LDKLevel_from_java(env, a);
30864 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30865 *ret_copy = ErrorAction_ignore_and_log(a_conv);
30866 uint64_t ret_ref = (uint64_t)ret_copy;
30870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
30871 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30872 *ret_copy = ErrorAction_ignore_duplicate_gossip();
30873 uint64_t ret_ref = (uint64_t)ret_copy;
30877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
30878 LDKErrorMessage msg_conv;
30879 msg_conv.inner = (void*)(msg & (~1));
30880 msg_conv.is_owned = (msg & 1) || (msg == 0);
30881 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30882 msg_conv = ErrorMessage_clone(&msg_conv);
30883 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30884 *ret_copy = ErrorAction_send_error_message(msg_conv);
30885 uint64_t ret_ref = (uint64_t)ret_copy;
30889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30890 LDKLightningError this_obj_conv;
30891 this_obj_conv.inner = (void*)(this_obj & (~1));
30892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30894 LightningError_free(this_obj_conv);
30897 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
30898 LDKLightningError this_ptr_conv;
30899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30900 this_ptr_conv.is_owned = false;
30901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30902 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
30903 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30909 LDKLightningError this_ptr_conv;
30910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30911 this_ptr_conv.is_owned = false;
30912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30913 LDKStr val_conv = java_to_owned_str(env, val);
30914 LightningError_set_err(&this_ptr_conv, val_conv);
30917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
30918 LDKLightningError this_ptr_conv;
30919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30920 this_ptr_conv.is_owned = false;
30921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30922 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30923 *ret_copy = LightningError_get_action(&this_ptr_conv);
30924 uint64_t ret_ref = (uint64_t)ret_copy;
30928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30929 LDKLightningError this_ptr_conv;
30930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30931 this_ptr_conv.is_owned = false;
30932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30933 void* val_ptr = (void*)(((uint64_t)val) & ~1);
30934 CHECK_ACCESS(val_ptr);
30935 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
30936 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
30937 LightningError_set_action(&this_ptr_conv, val_conv);
30940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
30941 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
30942 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
30943 CHECK_ACCESS(action_arg_ptr);
30944 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
30945 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
30946 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
30947 uint64_t ret_ref = 0;
30948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30951 ret_ref = (uint64_t)ret_var.inner;
30952 if (ret_var.is_owned) {
30958 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
30959 LDKLightningError ret_var = LightningError_clone(arg);
30960 uint64_t ret_ref = 0;
30961 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30962 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30964 ret_ref = (uint64_t)ret_var.inner;
30965 if (ret_var.is_owned) {
30970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30971 LDKLightningError arg_conv;
30972 arg_conv.inner = (void*)(arg & (~1));
30973 arg_conv.is_owned = false;
30974 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30975 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
30979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30980 LDKLightningError orig_conv;
30981 orig_conv.inner = (void*)(orig & (~1));
30982 orig_conv.is_owned = false;
30983 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30984 LDKLightningError ret_var = LightningError_clone(&orig_conv);
30985 uint64_t ret_ref = 0;
30986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30989 ret_ref = (uint64_t)ret_var.inner;
30990 if (ret_var.is_owned) {
30996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30997 LDKCommitmentUpdate this_obj_conv;
30998 this_obj_conv.inner = (void*)(this_obj & (~1));
30999 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31001 CommitmentUpdate_free(this_obj_conv);
31004 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31005 LDKCommitmentUpdate this_ptr_conv;
31006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31007 this_ptr_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31009 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
31010 int64_tArray ret_arr = NULL;
31011 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31012 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31013 for (size_t p = 0; p < ret_var.datalen; p++) {
31014 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
31015 uint64_t ret_conv_15_ref = 0;
31016 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31017 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
31019 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
31020 if (ret_conv_15_var.is_owned) {
31021 ret_conv_15_ref |= 1;
31023 ret_arr_ptr[p] = ret_conv_15_ref;
31025 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31026 FREE(ret_var.data);
31030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31031 LDKCommitmentUpdate this_ptr_conv;
31032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31033 this_ptr_conv.is_owned = false;
31034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31035 LDKCVec_UpdateAddHTLCZ val_constr;
31036 val_constr.datalen = (*env)->GetArrayLength(env, val);
31037 if (val_constr.datalen > 0)
31038 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
31040 val_constr.data = NULL;
31041 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31042 for (size_t p = 0; p < val_constr.datalen; p++) {
31043 int64_t val_conv_15 = val_vals[p];
31044 LDKUpdateAddHTLC val_conv_15_conv;
31045 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
31046 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
31047 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
31048 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
31049 val_constr.data[p] = val_conv_15_conv;
31051 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31052 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
31055 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31056 LDKCommitmentUpdate this_ptr_conv;
31057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31058 this_ptr_conv.is_owned = false;
31059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31060 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
31061 int64_tArray ret_arr = NULL;
31062 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31063 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31064 for (size_t t = 0; t < ret_var.datalen; t++) {
31065 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
31066 uint64_t ret_conv_19_ref = 0;
31067 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31068 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
31070 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
31071 if (ret_conv_19_var.is_owned) {
31072 ret_conv_19_ref |= 1;
31074 ret_arr_ptr[t] = ret_conv_19_ref;
31076 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31077 FREE(ret_var.data);
31081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31082 LDKCommitmentUpdate this_ptr_conv;
31083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31084 this_ptr_conv.is_owned = false;
31085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086 LDKCVec_UpdateFulfillHTLCZ val_constr;
31087 val_constr.datalen = (*env)->GetArrayLength(env, val);
31088 if (val_constr.datalen > 0)
31089 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
31091 val_constr.data = NULL;
31092 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31093 for (size_t t = 0; t < val_constr.datalen; t++) {
31094 int64_t val_conv_19 = val_vals[t];
31095 LDKUpdateFulfillHTLC val_conv_19_conv;
31096 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
31097 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
31098 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
31099 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
31100 val_constr.data[t] = val_conv_19_conv;
31102 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31103 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
31106 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31107 LDKCommitmentUpdate this_ptr_conv;
31108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31109 this_ptr_conv.is_owned = false;
31110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31111 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
31112 int64_tArray ret_arr = NULL;
31113 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31114 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31115 for (size_t q = 0; q < ret_var.datalen; q++) {
31116 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
31117 uint64_t ret_conv_16_ref = 0;
31118 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31119 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
31121 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
31122 if (ret_conv_16_var.is_owned) {
31123 ret_conv_16_ref |= 1;
31125 ret_arr_ptr[q] = ret_conv_16_ref;
31127 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31128 FREE(ret_var.data);
31132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31133 LDKCommitmentUpdate this_ptr_conv;
31134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31135 this_ptr_conv.is_owned = false;
31136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31137 LDKCVec_UpdateFailHTLCZ val_constr;
31138 val_constr.datalen = (*env)->GetArrayLength(env, val);
31139 if (val_constr.datalen > 0)
31140 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
31142 val_constr.data = NULL;
31143 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31144 for (size_t q = 0; q < val_constr.datalen; q++) {
31145 int64_t val_conv_16 = val_vals[q];
31146 LDKUpdateFailHTLC val_conv_16_conv;
31147 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
31148 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
31149 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
31150 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
31151 val_constr.data[q] = val_conv_16_conv;
31153 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31154 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
31157 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31158 LDKCommitmentUpdate this_ptr_conv;
31159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31160 this_ptr_conv.is_owned = false;
31161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31162 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
31163 int64_tArray ret_arr = NULL;
31164 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31165 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31166 for (size_t z = 0; z < ret_var.datalen; z++) {
31167 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
31168 uint64_t ret_conv_25_ref = 0;
31169 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31170 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
31172 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
31173 if (ret_conv_25_var.is_owned) {
31174 ret_conv_25_ref |= 1;
31176 ret_arr_ptr[z] = ret_conv_25_ref;
31178 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31179 FREE(ret_var.data);
31183 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) {
31184 LDKCommitmentUpdate this_ptr_conv;
31185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31186 this_ptr_conv.is_owned = false;
31187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31188 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
31189 val_constr.datalen = (*env)->GetArrayLength(env, val);
31190 if (val_constr.datalen > 0)
31191 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
31193 val_constr.data = NULL;
31194 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31195 for (size_t z = 0; z < val_constr.datalen; z++) {
31196 int64_t val_conv_25 = val_vals[z];
31197 LDKUpdateFailMalformedHTLC val_conv_25_conv;
31198 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
31199 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
31200 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
31201 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
31202 val_constr.data[z] = val_conv_25_conv;
31204 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31205 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
31208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
31209 LDKCommitmentUpdate this_ptr_conv;
31210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31211 this_ptr_conv.is_owned = false;
31212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31213 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
31214 uint64_t ret_ref = 0;
31215 if ((uint64_t)ret_var.inner > 4096) {
31216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31219 ret_ref = (uint64_t)ret_var.inner;
31220 if (ret_var.is_owned) {
31227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31228 LDKCommitmentUpdate this_ptr_conv;
31229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31230 this_ptr_conv.is_owned = false;
31231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31232 LDKUpdateFee val_conv;
31233 val_conv.inner = (void*)(val & (~1));
31234 val_conv.is_owned = (val & 1) || (val == 0);
31235 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31236 val_conv = UpdateFee_clone(&val_conv);
31237 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
31240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
31241 LDKCommitmentUpdate this_ptr_conv;
31242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31243 this_ptr_conv.is_owned = false;
31244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31245 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
31246 uint64_t ret_ref = 0;
31247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31250 ret_ref = (uint64_t)ret_var.inner;
31251 if (ret_var.is_owned) {
31257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31258 LDKCommitmentUpdate this_ptr_conv;
31259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31260 this_ptr_conv.is_owned = false;
31261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31262 LDKCommitmentSigned val_conv;
31263 val_conv.inner = (void*)(val & (~1));
31264 val_conv.is_owned = (val & 1) || (val == 0);
31265 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31266 val_conv = CommitmentSigned_clone(&val_conv);
31267 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
31270 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) {
31271 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
31272 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
31273 if (update_add_htlcs_arg_constr.datalen > 0)
31274 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
31276 update_add_htlcs_arg_constr.data = NULL;
31277 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
31278 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
31279 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
31280 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
31281 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
31282 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
31283 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
31284 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
31285 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
31287 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
31288 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
31289 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
31290 if (update_fulfill_htlcs_arg_constr.datalen > 0)
31291 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
31293 update_fulfill_htlcs_arg_constr.data = NULL;
31294 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
31295 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
31296 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
31297 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
31298 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
31299 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
31300 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
31301 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
31302 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
31304 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
31305 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
31306 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
31307 if (update_fail_htlcs_arg_constr.datalen > 0)
31308 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
31310 update_fail_htlcs_arg_constr.data = NULL;
31311 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
31312 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
31313 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
31314 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
31315 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
31316 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
31317 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
31318 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
31319 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
31321 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
31322 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
31323 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
31324 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
31325 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
31327 update_fail_malformed_htlcs_arg_constr.data = NULL;
31328 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
31329 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
31330 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
31331 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
31332 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
31333 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);
31334 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
31335 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
31336 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
31338 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
31339 LDKUpdateFee update_fee_arg_conv;
31340 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
31341 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
31342 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
31343 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
31344 LDKCommitmentSigned commitment_signed_arg_conv;
31345 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
31346 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
31347 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
31348 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
31349 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);
31350 uint64_t ret_ref = 0;
31351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31354 ret_ref = (uint64_t)ret_var.inner;
31355 if (ret_var.is_owned) {
31361 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
31362 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
31363 uint64_t ret_ref = 0;
31364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31367 ret_ref = (uint64_t)ret_var.inner;
31368 if (ret_var.is_owned) {
31373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31374 LDKCommitmentUpdate arg_conv;
31375 arg_conv.inner = (void*)(arg & (~1));
31376 arg_conv.is_owned = false;
31377 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31378 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
31382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31383 LDKCommitmentUpdate orig_conv;
31384 orig_conv.inner = (void*)(orig & (~1));
31385 orig_conv.is_owned = false;
31386 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31387 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
31388 uint64_t ret_ref = 0;
31389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31392 ret_ref = (uint64_t)ret_var.inner;
31393 if (ret_var.is_owned) {
31399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31400 if ((this_ptr & 1) != 0) return;
31401 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31402 CHECK_ACCESS(this_ptr_ptr);
31403 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
31404 FREE((void*)this_ptr);
31405 ChannelMessageHandler_free(this_ptr_conv);
31408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31409 if ((this_ptr & 1) != 0) return;
31410 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31411 CHECK_ACCESS(this_ptr_ptr);
31412 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
31413 FREE((void*)this_ptr);
31414 RoutingMessageHandler_free(this_ptr_conv);
31417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
31418 LDKAcceptChannel obj_conv;
31419 obj_conv.inner = (void*)(obj & (~1));
31420 obj_conv.is_owned = false;
31421 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31422 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
31423 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31424 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31425 CVec_u8Z_free(ret_var);
31429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31430 LDKu8slice ser_ref;
31431 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31432 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31433 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
31434 *ret_conv = AcceptChannel_read(ser_ref);
31435 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31436 return (uint64_t)ret_conv;
31439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
31440 LDKAnnouncementSignatures obj_conv;
31441 obj_conv.inner = (void*)(obj & (~1));
31442 obj_conv.is_owned = false;
31443 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31444 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
31445 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31446 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31447 CVec_u8Z_free(ret_var);
31451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31452 LDKu8slice ser_ref;
31453 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31454 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31455 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31456 *ret_conv = AnnouncementSignatures_read(ser_ref);
31457 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31458 return (uint64_t)ret_conv;
31461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
31462 LDKChannelReestablish obj_conv;
31463 obj_conv.inner = (void*)(obj & (~1));
31464 obj_conv.is_owned = false;
31465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31466 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
31467 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31468 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31469 CVec_u8Z_free(ret_var);
31473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31474 LDKu8slice ser_ref;
31475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31477 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31478 *ret_conv = ChannelReestablish_read(ser_ref);
31479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31480 return (uint64_t)ret_conv;
31483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
31484 LDKClosingSigned obj_conv;
31485 obj_conv.inner = (void*)(obj & (~1));
31486 obj_conv.is_owned = false;
31487 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31488 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
31489 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31490 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31491 CVec_u8Z_free(ret_var);
31495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31496 LDKu8slice ser_ref;
31497 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31498 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31499 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31500 *ret_conv = ClosingSigned_read(ser_ref);
31501 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31502 return (uint64_t)ret_conv;
31505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
31506 LDKClosingSignedFeeRange obj_conv;
31507 obj_conv.inner = (void*)(obj & (~1));
31508 obj_conv.is_owned = false;
31509 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31510 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
31511 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31512 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31513 CVec_u8Z_free(ret_var);
31517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31518 LDKu8slice ser_ref;
31519 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31520 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31521 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31522 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
31523 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31524 return (uint64_t)ret_conv;
31527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
31528 LDKCommitmentSigned obj_conv;
31529 obj_conv.inner = (void*)(obj & (~1));
31530 obj_conv.is_owned = false;
31531 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31532 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
31533 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31534 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31535 CVec_u8Z_free(ret_var);
31539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31540 LDKu8slice ser_ref;
31541 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31542 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31543 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31544 *ret_conv = CommitmentSigned_read(ser_ref);
31545 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31546 return (uint64_t)ret_conv;
31549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
31550 LDKFundingCreated obj_conv;
31551 obj_conv.inner = (void*)(obj & (~1));
31552 obj_conv.is_owned = false;
31553 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31554 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
31555 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31556 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31557 CVec_u8Z_free(ret_var);
31561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31562 LDKu8slice ser_ref;
31563 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31564 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31565 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31566 *ret_conv = FundingCreated_read(ser_ref);
31567 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31568 return (uint64_t)ret_conv;
31571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
31572 LDKFundingSigned obj_conv;
31573 obj_conv.inner = (void*)(obj & (~1));
31574 obj_conv.is_owned = false;
31575 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31576 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
31577 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31578 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31579 CVec_u8Z_free(ret_var);
31583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31584 LDKu8slice ser_ref;
31585 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31586 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31587 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31588 *ret_conv = FundingSigned_read(ser_ref);
31589 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31590 return (uint64_t)ret_conv;
31593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
31594 LDKFundingLocked obj_conv;
31595 obj_conv.inner = (void*)(obj & (~1));
31596 obj_conv.is_owned = false;
31597 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31598 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
31599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31601 CVec_u8Z_free(ret_var);
31605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31606 LDKu8slice ser_ref;
31607 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31608 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31609 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
31610 *ret_conv = FundingLocked_read(ser_ref);
31611 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31612 return (uint64_t)ret_conv;
31615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
31617 obj_conv.inner = (void*)(obj & (~1));
31618 obj_conv.is_owned = false;
31619 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31620 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
31621 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31622 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31623 CVec_u8Z_free(ret_var);
31627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31628 LDKu8slice ser_ref;
31629 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31630 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31631 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
31632 *ret_conv = Init_read(ser_ref);
31633 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31634 return (uint64_t)ret_conv;
31637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
31638 LDKOpenChannel obj_conv;
31639 obj_conv.inner = (void*)(obj & (~1));
31640 obj_conv.is_owned = false;
31641 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31642 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
31643 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31644 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31645 CVec_u8Z_free(ret_var);
31649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31650 LDKu8slice ser_ref;
31651 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31652 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31653 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
31654 *ret_conv = OpenChannel_read(ser_ref);
31655 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31656 return (uint64_t)ret_conv;
31659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
31660 LDKRevokeAndACK obj_conv;
31661 obj_conv.inner = (void*)(obj & (~1));
31662 obj_conv.is_owned = false;
31663 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31664 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
31665 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31666 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31667 CVec_u8Z_free(ret_var);
31671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31672 LDKu8slice ser_ref;
31673 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31674 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31675 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
31676 *ret_conv = RevokeAndACK_read(ser_ref);
31677 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31678 return (uint64_t)ret_conv;
31681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
31682 LDKShutdown obj_conv;
31683 obj_conv.inner = (void*)(obj & (~1));
31684 obj_conv.is_owned = false;
31685 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31686 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
31687 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31688 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31689 CVec_u8Z_free(ret_var);
31693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31694 LDKu8slice ser_ref;
31695 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31696 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31697 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
31698 *ret_conv = Shutdown_read(ser_ref);
31699 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31700 return (uint64_t)ret_conv;
31703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
31704 LDKUpdateFailHTLC obj_conv;
31705 obj_conv.inner = (void*)(obj & (~1));
31706 obj_conv.is_owned = false;
31707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31708 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
31709 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31710 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31711 CVec_u8Z_free(ret_var);
31715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31716 LDKu8slice ser_ref;
31717 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31718 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31719 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
31720 *ret_conv = UpdateFailHTLC_read(ser_ref);
31721 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31722 return (uint64_t)ret_conv;
31725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
31726 LDKUpdateFailMalformedHTLC obj_conv;
31727 obj_conv.inner = (void*)(obj & (~1));
31728 obj_conv.is_owned = false;
31729 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31730 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
31731 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31732 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31733 CVec_u8Z_free(ret_var);
31737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31738 LDKu8slice ser_ref;
31739 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31740 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31741 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
31742 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
31743 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31744 return (uint64_t)ret_conv;
31747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
31748 LDKUpdateFee obj_conv;
31749 obj_conv.inner = (void*)(obj & (~1));
31750 obj_conv.is_owned = false;
31751 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31752 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
31753 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31754 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31755 CVec_u8Z_free(ret_var);
31759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31760 LDKu8slice ser_ref;
31761 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31762 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31763 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
31764 *ret_conv = UpdateFee_read(ser_ref);
31765 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31766 return (uint64_t)ret_conv;
31769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
31770 LDKUpdateFulfillHTLC obj_conv;
31771 obj_conv.inner = (void*)(obj & (~1));
31772 obj_conv.is_owned = false;
31773 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31774 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
31775 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31776 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31777 CVec_u8Z_free(ret_var);
31781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31782 LDKu8slice ser_ref;
31783 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31784 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31785 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
31786 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
31787 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31788 return (uint64_t)ret_conv;
31791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
31792 LDKUpdateAddHTLC obj_conv;
31793 obj_conv.inner = (void*)(obj & (~1));
31794 obj_conv.is_owned = false;
31795 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31796 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
31797 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31798 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31799 CVec_u8Z_free(ret_var);
31803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31804 LDKu8slice ser_ref;
31805 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31806 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31807 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
31808 *ret_conv = UpdateAddHTLC_read(ser_ref);
31809 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31810 return (uint64_t)ret_conv;
31813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
31815 obj_conv.inner = (void*)(obj & (~1));
31816 obj_conv.is_owned = false;
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31818 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
31819 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31820 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31821 CVec_u8Z_free(ret_var);
31825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31826 LDKu8slice ser_ref;
31827 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31828 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31829 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
31830 *ret_conv = Ping_read(ser_ref);
31831 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31832 return (uint64_t)ret_conv;
31835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
31837 obj_conv.inner = (void*)(obj & (~1));
31838 obj_conv.is_owned = false;
31839 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31840 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
31841 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31842 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31843 CVec_u8Z_free(ret_var);
31847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31848 LDKu8slice ser_ref;
31849 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31850 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31851 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
31852 *ret_conv = Pong_read(ser_ref);
31853 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31854 return (uint64_t)ret_conv;
31857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
31858 LDKUnsignedChannelAnnouncement obj_conv;
31859 obj_conv.inner = (void*)(obj & (~1));
31860 obj_conv.is_owned = false;
31861 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31862 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
31863 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31864 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31865 CVec_u8Z_free(ret_var);
31869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31870 LDKu8slice ser_ref;
31871 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31872 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31873 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
31874 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
31875 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31876 return (uint64_t)ret_conv;
31879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
31880 LDKChannelAnnouncement obj_conv;
31881 obj_conv.inner = (void*)(obj & (~1));
31882 obj_conv.is_owned = false;
31883 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31884 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
31885 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31886 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31887 CVec_u8Z_free(ret_var);
31891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31892 LDKu8slice ser_ref;
31893 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31894 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31895 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
31896 *ret_conv = ChannelAnnouncement_read(ser_ref);
31897 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31898 return (uint64_t)ret_conv;
31901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
31902 LDKUnsignedChannelUpdate obj_conv;
31903 obj_conv.inner = (void*)(obj & (~1));
31904 obj_conv.is_owned = false;
31905 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31906 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
31907 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31908 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31909 CVec_u8Z_free(ret_var);
31913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31914 LDKu8slice ser_ref;
31915 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31916 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31917 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
31918 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
31919 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31920 return (uint64_t)ret_conv;
31923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
31924 LDKChannelUpdate obj_conv;
31925 obj_conv.inner = (void*)(obj & (~1));
31926 obj_conv.is_owned = false;
31927 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31928 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
31929 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31930 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31931 CVec_u8Z_free(ret_var);
31935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31936 LDKu8slice ser_ref;
31937 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31938 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31939 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
31940 *ret_conv = ChannelUpdate_read(ser_ref);
31941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31942 return (uint64_t)ret_conv;
31945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
31946 LDKErrorMessage obj_conv;
31947 obj_conv.inner = (void*)(obj & (~1));
31948 obj_conv.is_owned = false;
31949 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31950 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
31951 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31952 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31953 CVec_u8Z_free(ret_var);
31957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31958 LDKu8slice ser_ref;
31959 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31960 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31961 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
31962 *ret_conv = ErrorMessage_read(ser_ref);
31963 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31964 return (uint64_t)ret_conv;
31967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
31968 LDKUnsignedNodeAnnouncement obj_conv;
31969 obj_conv.inner = (void*)(obj & (~1));
31970 obj_conv.is_owned = false;
31971 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31972 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
31973 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31974 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31975 CVec_u8Z_free(ret_var);
31979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31980 LDKu8slice ser_ref;
31981 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31982 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31983 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31984 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
31985 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31986 return (uint64_t)ret_conv;
31989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
31990 LDKNodeAnnouncement obj_conv;
31991 obj_conv.inner = (void*)(obj & (~1));
31992 obj_conv.is_owned = false;
31993 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31994 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
31995 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31996 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31997 CVec_u8Z_free(ret_var);
32001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32002 LDKu8slice ser_ref;
32003 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32004 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32005 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
32006 *ret_conv = NodeAnnouncement_read(ser_ref);
32007 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32008 return (uint64_t)ret_conv;
32011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32012 LDKu8slice ser_ref;
32013 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32014 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32015 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
32016 *ret_conv = QueryShortChannelIds_read(ser_ref);
32017 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32018 return (uint64_t)ret_conv;
32021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
32022 LDKQueryShortChannelIds obj_conv;
32023 obj_conv.inner = (void*)(obj & (~1));
32024 obj_conv.is_owned = false;
32025 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32026 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
32027 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32028 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32029 CVec_u8Z_free(ret_var);
32033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
32034 LDKReplyShortChannelIdsEnd obj_conv;
32035 obj_conv.inner = (void*)(obj & (~1));
32036 obj_conv.is_owned = false;
32037 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32038 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
32039 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32040 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32041 CVec_u8Z_free(ret_var);
32045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32046 LDKu8slice ser_ref;
32047 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32048 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32049 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
32050 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
32051 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32052 return (uint64_t)ret_conv;
32055 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
32056 LDKQueryChannelRange this_arg_conv;
32057 this_arg_conv.inner = (void*)(this_arg & (~1));
32058 this_arg_conv.is_owned = false;
32059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32060 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
32064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
32065 LDKQueryChannelRange obj_conv;
32066 obj_conv.inner = (void*)(obj & (~1));
32067 obj_conv.is_owned = false;
32068 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32069 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
32070 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32071 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32072 CVec_u8Z_free(ret_var);
32076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32077 LDKu8slice ser_ref;
32078 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32079 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32080 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
32081 *ret_conv = QueryChannelRange_read(ser_ref);
32082 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32083 return (uint64_t)ret_conv;
32086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32087 LDKu8slice ser_ref;
32088 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32089 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32090 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
32091 *ret_conv = ReplyChannelRange_read(ser_ref);
32092 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32093 return (uint64_t)ret_conv;
32096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
32097 LDKReplyChannelRange obj_conv;
32098 obj_conv.inner = (void*)(obj & (~1));
32099 obj_conv.is_owned = false;
32100 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32101 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
32102 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32103 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32104 CVec_u8Z_free(ret_var);
32108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
32109 LDKGossipTimestampFilter obj_conv;
32110 obj_conv.inner = (void*)(obj & (~1));
32111 obj_conv.is_owned = false;
32112 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32113 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
32114 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32115 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32116 CVec_u8Z_free(ret_var);
32120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32121 LDKu8slice ser_ref;
32122 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32123 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32124 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
32125 *ret_conv = GossipTimestampFilter_read(ser_ref);
32126 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32127 return (uint64_t)ret_conv;
32130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32131 if ((this_ptr & 1) != 0) return;
32132 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
32133 CHECK_ACCESS(this_ptr_ptr);
32134 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
32135 FREE((void*)this_ptr);
32136 CustomMessageHandler_free(this_ptr_conv);
32139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32140 LDKIgnoringMessageHandler this_obj_conv;
32141 this_obj_conv.inner = (void*)(this_obj & (~1));
32142 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32144 IgnoringMessageHandler_free(this_obj_conv);
32147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
32148 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
32149 uint64_t ret_ref = 0;
32150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32153 ret_ref = (uint64_t)ret_var.inner;
32154 if (ret_var.is_owned) {
32160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
32161 LDKIgnoringMessageHandler this_arg_conv;
32162 this_arg_conv.inner = (void*)(this_arg & (~1));
32163 this_arg_conv.is_owned = false;
32164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32165 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
32166 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
32167 return (uint64_t)ret_ret;
32170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
32171 LDKIgnoringMessageHandler this_arg_conv;
32172 this_arg_conv.inner = (void*)(this_arg & (~1));
32173 this_arg_conv.is_owned = false;
32174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32175 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
32176 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
32177 return (uint64_t)ret_ret;
32180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
32181 LDKIgnoringMessageHandler this_arg_conv;
32182 this_arg_conv.inner = (void*)(this_arg & (~1));
32183 this_arg_conv.is_owned = false;
32184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32185 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
32186 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
32187 return (uint64_t)ret_ret;
32190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
32191 LDKIgnoringMessageHandler this_arg_conv;
32192 this_arg_conv.inner = (void*)(this_arg & (~1));
32193 this_arg_conv.is_owned = false;
32194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32195 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
32196 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
32197 return (uint64_t)ret_ret;
32200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32201 LDKErroringMessageHandler this_obj_conv;
32202 this_obj_conv.inner = (void*)(this_obj & (~1));
32203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32205 ErroringMessageHandler_free(this_obj_conv);
32208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
32209 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
32210 uint64_t ret_ref = 0;
32211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32214 ret_ref = (uint64_t)ret_var.inner;
32215 if (ret_var.is_owned) {
32221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
32222 LDKErroringMessageHandler this_arg_conv;
32223 this_arg_conv.inner = (void*)(this_arg & (~1));
32224 this_arg_conv.is_owned = false;
32225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32226 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
32227 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
32228 return (uint64_t)ret_ret;
32231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
32232 LDKErroringMessageHandler this_arg_conv;
32233 this_arg_conv.inner = (void*)(this_arg & (~1));
32234 this_arg_conv.is_owned = false;
32235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32236 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
32237 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
32238 return (uint64_t)ret_ret;
32241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32242 LDKMessageHandler this_obj_conv;
32243 this_obj_conv.inner = (void*)(this_obj & (~1));
32244 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32246 MessageHandler_free(this_obj_conv);
32249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
32250 LDKMessageHandler this_ptr_conv;
32251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32252 this_ptr_conv.is_owned = false;
32253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32254 // WARNING: This object doesn't live past this scope, needs clone!
32255 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
32259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32260 LDKMessageHandler this_ptr_conv;
32261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32262 this_ptr_conv.is_owned = false;
32263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32264 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32265 CHECK_ACCESS(val_ptr);
32266 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
32267 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
32268 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32269 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
32271 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
32274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
32275 LDKMessageHandler this_ptr_conv;
32276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32277 this_ptr_conv.is_owned = false;
32278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32279 // WARNING: This object doesn't live past this scope, needs clone!
32280 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
32284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32285 LDKMessageHandler this_ptr_conv;
32286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32287 this_ptr_conv.is_owned = false;
32288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32289 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32290 CHECK_ACCESS(val_ptr);
32291 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
32292 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
32293 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32294 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
32296 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
32299 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) {
32300 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
32301 CHECK_ACCESS(chan_handler_arg_ptr);
32302 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
32303 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
32304 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32305 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
32307 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
32308 CHECK_ACCESS(route_handler_arg_ptr);
32309 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
32310 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
32311 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32312 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
32314 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
32315 uint64_t ret_ref = 0;
32316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32319 ret_ref = (uint64_t)ret_var.inner;
32320 if (ret_var.is_owned) {
32326 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
32327 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
32328 *ret_ret = SocketDescriptor_clone(arg);
32329 return (uint64_t)ret_ret;
32331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32332 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
32333 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
32334 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
32335 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
32339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32340 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
32341 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
32342 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
32343 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
32344 *ret_ret = SocketDescriptor_clone(orig_conv);
32345 return (uint64_t)ret_ret;
32348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32349 if ((this_ptr & 1) != 0) return;
32350 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
32351 CHECK_ACCESS(this_ptr_ptr);
32352 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
32353 FREE((void*)this_ptr);
32354 SocketDescriptor_free(this_ptr_conv);
32357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32358 LDKPeerHandleError this_obj_conv;
32359 this_obj_conv.inner = (void*)(this_obj & (~1));
32360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32362 PeerHandleError_free(this_obj_conv);
32365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
32366 LDKPeerHandleError this_ptr_conv;
32367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32368 this_ptr_conv.is_owned = false;
32369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32370 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
32374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32375 LDKPeerHandleError this_ptr_conv;
32376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32377 this_ptr_conv.is_owned = false;
32378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32379 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
32382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
32383 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
32384 uint64_t ret_ref = 0;
32385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32388 ret_ref = (uint64_t)ret_var.inner;
32389 if (ret_var.is_owned) {
32395 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
32396 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
32397 uint64_t ret_ref = 0;
32398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32401 ret_ref = (uint64_t)ret_var.inner;
32402 if (ret_var.is_owned) {
32407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32408 LDKPeerHandleError arg_conv;
32409 arg_conv.inner = (void*)(arg & (~1));
32410 arg_conv.is_owned = false;
32411 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32412 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
32416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32417 LDKPeerHandleError orig_conv;
32418 orig_conv.inner = (void*)(orig & (~1));
32419 orig_conv.is_owned = false;
32420 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32421 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
32422 uint64_t ret_ref = 0;
32423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32426 ret_ref = (uint64_t)ret_var.inner;
32427 if (ret_var.is_owned) {
32433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32434 LDKPeerManager this_obj_conv;
32435 this_obj_conv.inner = (void*)(this_obj & (~1));
32436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32438 PeerManager_free(this_obj_conv);
32441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
32442 LDKMessageHandler message_handler_conv;
32443 message_handler_conv.inner = (void*)(message_handler & (~1));
32444 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
32445 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
32446 // Warning: we need a move here but no clone is available for LDKMessageHandler
32447 LDKSecretKey our_node_secret_ref;
32448 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
32449 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
32450 unsigned char ephemeral_random_data_arr[32];
32451 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
32452 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
32453 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
32454 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
32455 CHECK_ACCESS(logger_ptr);
32456 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32457 if (logger_conv.free == LDKLogger_JCalls_free) {
32458 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32459 LDKLogger_JCalls_cloned(&logger_conv);
32461 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
32462 CHECK_ACCESS(custom_message_handler_ptr);
32463 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
32464 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
32465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32466 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
32468 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
32469 uint64_t ret_ref = 0;
32470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32473 ret_ref = (uint64_t)ret_var.inner;
32474 if (ret_var.is_owned) {
32480 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
32481 LDKPeerManager this_arg_conv;
32482 this_arg_conv.inner = (void*)(this_arg & (~1));
32483 this_arg_conv.is_owned = false;
32484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32485 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
32486 jobjectArray ret_arr = NULL;
32487 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
32489 for (size_t i = 0; i < ret_var.datalen; i++) {
32490 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
32491 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
32492 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
32495 FREE(ret_var.data);
32499 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) {
32500 LDKPeerManager this_arg_conv;
32501 this_arg_conv.inner = (void*)(this_arg & (~1));
32502 this_arg_conv.is_owned = false;
32503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32504 LDKPublicKey their_node_id_ref;
32505 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
32506 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
32507 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
32508 CHECK_ACCESS(descriptor_ptr);
32509 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32510 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
32511 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32512 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
32514 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32515 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
32516 return (uint64_t)ret_conv;
32519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
32520 LDKPeerManager this_arg_conv;
32521 this_arg_conv.inner = (void*)(this_arg & (~1));
32522 this_arg_conv.is_owned = false;
32523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32524 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
32525 CHECK_ACCESS(descriptor_ptr);
32526 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32527 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
32528 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32529 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
32531 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32532 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
32533 return (uint64_t)ret_conv;
32536 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) {
32537 LDKPeerManager this_arg_conv;
32538 this_arg_conv.inner = (void*)(this_arg & (~1));
32539 this_arg_conv.is_owned = false;
32540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32541 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
32542 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32543 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32544 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32545 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
32546 return (uint64_t)ret_conv;
32549 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) {
32550 LDKPeerManager this_arg_conv;
32551 this_arg_conv.inner = (void*)(this_arg & (~1));
32552 this_arg_conv.is_owned = false;
32553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32554 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
32555 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
32556 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
32557 LDKu8slice data_ref;
32558 data_ref.datalen = (*env)->GetArrayLength(env, data);
32559 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
32560 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32561 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
32562 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
32563 return (uint64_t)ret_conv;
32566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
32567 LDKPeerManager this_arg_conv;
32568 this_arg_conv.inner = (void*)(this_arg & (~1));
32569 this_arg_conv.is_owned = false;
32570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32571 PeerManager_process_events(&this_arg_conv);
32574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
32575 LDKPeerManager this_arg_conv;
32576 this_arg_conv.inner = (void*)(this_arg & (~1));
32577 this_arg_conv.is_owned = false;
32578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32579 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
32580 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32581 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32582 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
32585 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) {
32586 LDKPeerManager this_arg_conv;
32587 this_arg_conv.inner = (void*)(this_arg & (~1));
32588 this_arg_conv.is_owned = false;
32589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32590 LDKPublicKey node_id_ref;
32591 CHECK((*env)->GetArrayLength(env, node_id) == 33);
32592 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
32593 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
32596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
32597 LDKPeerManager this_arg_conv;
32598 this_arg_conv.inner = (void*)(this_arg & (~1));
32599 this_arg_conv.is_owned = false;
32600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32601 PeerManager_disconnect_all_peers(&this_arg_conv);
32604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
32605 LDKPeerManager this_arg_conv;
32606 this_arg_conv.inner = (void*)(this_arg & (~1));
32607 this_arg_conv.is_owned = false;
32608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32609 PeerManager_timer_tick_occurred(&this_arg_conv);
32612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
32613 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
32617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
32618 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
32622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
32623 unsigned char commitment_seed_arr[32];
32624 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
32625 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
32626 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
32627 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32628 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
32632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
32633 LDKCVec_u8Z to_holder_script_ref;
32634 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
32635 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
32636 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
32637 LDKCVec_u8Z to_counterparty_script_ref;
32638 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
32639 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
32640 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
32641 LDKOutPoint funding_outpoint_conv;
32642 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
32643 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
32644 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
32645 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
32646 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
32647 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32648 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32649 Transaction_free(ret_var);
32653 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) {
32654 LDKPublicKey per_commitment_point_ref;
32655 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
32656 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
32657 unsigned char base_secret_arr[32];
32658 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
32659 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
32660 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
32661 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32662 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
32663 return (uint64_t)ret_conv;
32666 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) {
32667 LDKPublicKey per_commitment_point_ref;
32668 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
32669 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
32670 LDKPublicKey base_point_ref;
32671 CHECK((*env)->GetArrayLength(env, base_point) == 33);
32672 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
32673 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32674 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
32675 return (uint64_t)ret_conv;
32678 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) {
32679 unsigned char per_commitment_secret_arr[32];
32680 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
32681 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
32682 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
32683 unsigned char countersignatory_revocation_base_secret_arr[32];
32684 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
32685 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
32686 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
32687 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32688 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
32689 return (uint64_t)ret_conv;
32692 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) {
32693 LDKPublicKey per_commitment_point_ref;
32694 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
32695 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
32696 LDKPublicKey countersignatory_revocation_base_point_ref;
32697 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
32698 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
32699 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32700 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
32701 return (uint64_t)ret_conv;
32704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32705 LDKTxCreationKeys this_obj_conv;
32706 this_obj_conv.inner = (void*)(this_obj & (~1));
32707 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32709 TxCreationKeys_free(this_obj_conv);
32712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32713 LDKTxCreationKeys this_ptr_conv;
32714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32715 this_ptr_conv.is_owned = false;
32716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32717 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32718 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
32722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32723 LDKTxCreationKeys this_ptr_conv;
32724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32725 this_ptr_conv.is_owned = false;
32726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32727 LDKPublicKey val_ref;
32728 CHECK((*env)->GetArrayLength(env, val) == 33);
32729 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32730 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
32733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
32734 LDKTxCreationKeys this_ptr_conv;
32735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32736 this_ptr_conv.is_owned = false;
32737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32738 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32739 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
32743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32744 LDKTxCreationKeys this_ptr_conv;
32745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32746 this_ptr_conv.is_owned = false;
32747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32748 LDKPublicKey val_ref;
32749 CHECK((*env)->GetArrayLength(env, val) == 33);
32750 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32751 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
32754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
32755 LDKTxCreationKeys this_ptr_conv;
32756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32757 this_ptr_conv.is_owned = false;
32758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32759 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32760 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
32764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32765 LDKTxCreationKeys this_ptr_conv;
32766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32767 this_ptr_conv.is_owned = false;
32768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32769 LDKPublicKey val_ref;
32770 CHECK((*env)->GetArrayLength(env, val) == 33);
32771 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32772 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
32775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
32776 LDKTxCreationKeys this_ptr_conv;
32777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32778 this_ptr_conv.is_owned = false;
32779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32780 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
32785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32786 LDKTxCreationKeys this_ptr_conv;
32787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32788 this_ptr_conv.is_owned = false;
32789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32790 LDKPublicKey val_ref;
32791 CHECK((*env)->GetArrayLength(env, val) == 33);
32792 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32793 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
32796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
32797 LDKTxCreationKeys this_ptr_conv;
32798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32799 this_ptr_conv.is_owned = false;
32800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32801 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32802 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
32806 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) {
32807 LDKTxCreationKeys this_ptr_conv;
32808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32809 this_ptr_conv.is_owned = false;
32810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32811 LDKPublicKey val_ref;
32812 CHECK((*env)->GetArrayLength(env, val) == 33);
32813 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32814 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
32817 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) {
32818 LDKPublicKey per_commitment_point_arg_ref;
32819 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
32820 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
32821 LDKPublicKey revocation_key_arg_ref;
32822 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
32823 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
32824 LDKPublicKey broadcaster_htlc_key_arg_ref;
32825 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
32826 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
32827 LDKPublicKey countersignatory_htlc_key_arg_ref;
32828 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
32829 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
32830 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
32831 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
32832 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
32833 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);
32834 uint64_t ret_ref = 0;
32835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32838 ret_ref = (uint64_t)ret_var.inner;
32839 if (ret_var.is_owned) {
32845 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
32846 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
32847 uint64_t ret_ref = 0;
32848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32851 ret_ref = (uint64_t)ret_var.inner;
32852 if (ret_var.is_owned) {
32857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32858 LDKTxCreationKeys arg_conv;
32859 arg_conv.inner = (void*)(arg & (~1));
32860 arg_conv.is_owned = false;
32861 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32862 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
32866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32867 LDKTxCreationKeys orig_conv;
32868 orig_conv.inner = (void*)(orig & (~1));
32869 orig_conv.is_owned = false;
32870 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32871 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
32872 uint64_t ret_ref = 0;
32873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32876 ret_ref = (uint64_t)ret_var.inner;
32877 if (ret_var.is_owned) {
32883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
32884 LDKTxCreationKeys obj_conv;
32885 obj_conv.inner = (void*)(obj & (~1));
32886 obj_conv.is_owned = false;
32887 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32888 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
32889 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32890 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32891 CVec_u8Z_free(ret_var);
32895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32896 LDKu8slice ser_ref;
32897 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32898 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32899 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
32900 *ret_conv = TxCreationKeys_read(ser_ref);
32901 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32902 return (uint64_t)ret_conv;
32905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32906 LDKChannelPublicKeys this_obj_conv;
32907 this_obj_conv.inner = (void*)(this_obj & (~1));
32908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32910 ChannelPublicKeys_free(this_obj_conv);
32913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32914 LDKChannelPublicKeys this_ptr_conv;
32915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32916 this_ptr_conv.is_owned = false;
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32918 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
32923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32924 LDKChannelPublicKeys this_ptr_conv;
32925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32926 this_ptr_conv.is_owned = false;
32927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32928 LDKPublicKey val_ref;
32929 CHECK((*env)->GetArrayLength(env, val) == 33);
32930 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32931 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
32934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32935 LDKChannelPublicKeys this_ptr_conv;
32936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32937 this_ptr_conv.is_owned = false;
32938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32939 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32940 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32945 LDKChannelPublicKeys this_ptr_conv;
32946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32947 this_ptr_conv.is_owned = false;
32948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32949 LDKPublicKey val_ref;
32950 CHECK((*env)->GetArrayLength(env, val) == 33);
32951 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32952 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
32955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32956 LDKChannelPublicKeys this_ptr_conv;
32957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32958 this_ptr_conv.is_owned = false;
32959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32960 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32961 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
32965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32966 LDKChannelPublicKeys this_ptr_conv;
32967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32968 this_ptr_conv.is_owned = false;
32969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32970 LDKPublicKey val_ref;
32971 CHECK((*env)->GetArrayLength(env, val) == 33);
32972 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32973 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
32976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32977 LDKChannelPublicKeys this_ptr_conv;
32978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32979 this_ptr_conv.is_owned = false;
32980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32981 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32987 LDKChannelPublicKeys this_ptr_conv;
32988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32989 this_ptr_conv.is_owned = false;
32990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32991 LDKPublicKey val_ref;
32992 CHECK((*env)->GetArrayLength(env, val) == 33);
32993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32994 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32998 LDKChannelPublicKeys this_ptr_conv;
32999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33000 this_ptr_conv.is_owned = false;
33001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33002 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33003 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
33007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33008 LDKChannelPublicKeys this_ptr_conv;
33009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33010 this_ptr_conv.is_owned = false;
33011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33012 LDKPublicKey val_ref;
33013 CHECK((*env)->GetArrayLength(env, val) == 33);
33014 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33015 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
33018 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) {
33019 LDKPublicKey funding_pubkey_arg_ref;
33020 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
33021 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
33022 LDKPublicKey revocation_basepoint_arg_ref;
33023 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
33024 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
33025 LDKPublicKey payment_point_arg_ref;
33026 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
33027 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
33028 LDKPublicKey delayed_payment_basepoint_arg_ref;
33029 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
33030 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
33031 LDKPublicKey htlc_basepoint_arg_ref;
33032 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
33033 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
33034 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);
33035 uint64_t ret_ref = 0;
33036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33039 ret_ref = (uint64_t)ret_var.inner;
33040 if (ret_var.is_owned) {
33046 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
33047 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
33048 uint64_t ret_ref = 0;
33049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33052 ret_ref = (uint64_t)ret_var.inner;
33053 if (ret_var.is_owned) {
33058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33059 LDKChannelPublicKeys arg_conv;
33060 arg_conv.inner = (void*)(arg & (~1));
33061 arg_conv.is_owned = false;
33062 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33063 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
33067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33068 LDKChannelPublicKeys orig_conv;
33069 orig_conv.inner = (void*)(orig & (~1));
33070 orig_conv.is_owned = false;
33071 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33072 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
33073 uint64_t ret_ref = 0;
33074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33077 ret_ref = (uint64_t)ret_var.inner;
33078 if (ret_var.is_owned) {
33084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
33085 LDKChannelPublicKeys obj_conv;
33086 obj_conv.inner = (void*)(obj & (~1));
33087 obj_conv.is_owned = false;
33088 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33089 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
33090 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33091 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33092 CVec_u8Z_free(ret_var);
33096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33097 LDKu8slice ser_ref;
33098 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33099 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33100 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33101 *ret_conv = ChannelPublicKeys_read(ser_ref);
33102 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33103 return (uint64_t)ret_conv;
33106 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) {
33107 LDKPublicKey per_commitment_point_ref;
33108 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
33109 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
33110 LDKPublicKey broadcaster_delayed_payment_base_ref;
33111 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
33112 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
33113 LDKPublicKey broadcaster_htlc_base_ref;
33114 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
33115 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
33116 LDKPublicKey countersignatory_revocation_base_ref;
33117 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
33118 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
33119 LDKPublicKey countersignatory_htlc_base_ref;
33120 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
33121 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
33122 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
33123 *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);
33124 return (uint64_t)ret_conv;
33127 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) {
33128 LDKPublicKey per_commitment_point_ref;
33129 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
33130 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
33131 LDKChannelPublicKeys broadcaster_keys_conv;
33132 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
33133 broadcaster_keys_conv.is_owned = false;
33134 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
33135 LDKChannelPublicKeys countersignatory_keys_conv;
33136 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
33137 countersignatory_keys_conv.is_owned = false;
33138 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
33139 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
33140 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
33141 return (uint64_t)ret_conv;
33144 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) {
33145 LDKPublicKey revocation_key_ref;
33146 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
33147 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
33148 LDKPublicKey broadcaster_delayed_payment_key_ref;
33149 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
33150 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
33151 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
33152 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33153 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33154 CVec_u8Z_free(ret_var);
33158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33159 LDKHTLCOutputInCommitment this_obj_conv;
33160 this_obj_conv.inner = (void*)(this_obj & (~1));
33161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33163 HTLCOutputInCommitment_free(this_obj_conv);
33166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
33167 LDKHTLCOutputInCommitment this_ptr_conv;
33168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33169 this_ptr_conv.is_owned = false;
33170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33171 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
33175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33176 LDKHTLCOutputInCommitment this_ptr_conv;
33177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33178 this_ptr_conv.is_owned = false;
33179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33180 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
33183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33184 LDKHTLCOutputInCommitment this_ptr_conv;
33185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33186 this_ptr_conv.is_owned = false;
33187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33188 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
33192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33193 LDKHTLCOutputInCommitment this_ptr_conv;
33194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33195 this_ptr_conv.is_owned = false;
33196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33197 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
33200 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
33201 LDKHTLCOutputInCommitment this_ptr_conv;
33202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33203 this_ptr_conv.is_owned = false;
33204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33205 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
33209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33210 LDKHTLCOutputInCommitment this_ptr_conv;
33211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33212 this_ptr_conv.is_owned = false;
33213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33214 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
33217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33218 LDKHTLCOutputInCommitment this_ptr_conv;
33219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33220 this_ptr_conv.is_owned = false;
33221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33222 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
33227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33228 LDKHTLCOutputInCommitment this_ptr_conv;
33229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33230 this_ptr_conv.is_owned = false;
33231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33232 LDKThirtyTwoBytes val_ref;
33233 CHECK((*env)->GetArrayLength(env, val) == 32);
33234 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33235 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
33238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
33239 LDKHTLCOutputInCommitment this_ptr_conv;
33240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33241 this_ptr_conv.is_owned = false;
33242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33243 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33244 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
33245 uint64_t ret_ref = (uint64_t)ret_copy;
33249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33250 LDKHTLCOutputInCommitment this_ptr_conv;
33251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33252 this_ptr_conv.is_owned = false;
33253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33254 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33255 CHECK_ACCESS(val_ptr);
33256 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33257 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
33258 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
33261 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) {
33262 LDKThirtyTwoBytes payment_hash_arg_ref;
33263 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
33264 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
33265 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
33266 CHECK_ACCESS(transaction_output_index_arg_ptr);
33267 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
33268 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
33269 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
33270 uint64_t ret_ref = 0;
33271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33274 ret_ref = (uint64_t)ret_var.inner;
33275 if (ret_var.is_owned) {
33281 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
33282 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
33283 uint64_t ret_ref = 0;
33284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33287 ret_ref = (uint64_t)ret_var.inner;
33288 if (ret_var.is_owned) {
33293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33294 LDKHTLCOutputInCommitment arg_conv;
33295 arg_conv.inner = (void*)(arg & (~1));
33296 arg_conv.is_owned = false;
33297 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33298 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
33302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33303 LDKHTLCOutputInCommitment orig_conv;
33304 orig_conv.inner = (void*)(orig & (~1));
33305 orig_conv.is_owned = false;
33306 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33307 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
33308 uint64_t ret_ref = 0;
33309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33312 ret_ref = (uint64_t)ret_var.inner;
33313 if (ret_var.is_owned) {
33319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
33320 LDKHTLCOutputInCommitment obj_conv;
33321 obj_conv.inner = (void*)(obj & (~1));
33322 obj_conv.is_owned = false;
33323 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33324 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
33325 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33326 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33327 CVec_u8Z_free(ret_var);
33331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33332 LDKu8slice ser_ref;
33333 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33334 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33335 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33336 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
33337 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33338 return (uint64_t)ret_conv;
33341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) {
33342 LDKHTLCOutputInCommitment htlc_conv;
33343 htlc_conv.inner = (void*)(htlc & (~1));
33344 htlc_conv.is_owned = false;
33345 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33346 LDKTxCreationKeys keys_conv;
33347 keys_conv.inner = (void*)(keys & (~1));
33348 keys_conv.is_owned = false;
33349 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
33350 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
33351 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33352 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33353 CVec_u8Z_free(ret_var);
33357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
33358 LDKPublicKey broadcaster_ref;
33359 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
33360 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
33361 LDKPublicKey countersignatory_ref;
33362 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
33363 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
33364 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
33365 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33366 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33367 CVec_u8Z_free(ret_var);
33371 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, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
33372 unsigned char commitment_txid_arr[32];
33373 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
33374 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
33375 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
33376 LDKHTLCOutputInCommitment htlc_conv;
33377 htlc_conv.inner = (void*)(htlc & (~1));
33378 htlc_conv.is_owned = false;
33379 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33380 LDKPublicKey broadcaster_delayed_payment_key_ref;
33381 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
33382 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
33383 LDKPublicKey revocation_key_ref;
33384 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
33385 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
33386 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
33387 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33388 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33389 Transaction_free(ret_var);
33393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
33394 LDKPublicKey funding_pubkey_ref;
33395 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
33396 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
33397 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
33398 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33399 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33400 CVec_u8Z_free(ret_var);
33404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33405 LDKChannelTransactionParameters this_obj_conv;
33406 this_obj_conv.inner = (void*)(this_obj & (~1));
33407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33409 ChannelTransactionParameters_free(this_obj_conv);
33412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
33413 LDKChannelTransactionParameters this_ptr_conv;
33414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33415 this_ptr_conv.is_owned = false;
33416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33417 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
33418 uint64_t ret_ref = 0;
33419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33422 ret_ref = (uint64_t)ret_var.inner;
33423 if (ret_var.is_owned) {
33429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33430 LDKChannelTransactionParameters this_ptr_conv;
33431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33432 this_ptr_conv.is_owned = false;
33433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33434 LDKChannelPublicKeys val_conv;
33435 val_conv.inner = (void*)(val & (~1));
33436 val_conv.is_owned = (val & 1) || (val == 0);
33437 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33438 val_conv = ChannelPublicKeys_clone(&val_conv);
33439 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
33442 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33443 LDKChannelTransactionParameters this_ptr_conv;
33444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33445 this_ptr_conv.is_owned = false;
33446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
33451 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) {
33452 LDKChannelTransactionParameters this_ptr_conv;
33453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33454 this_ptr_conv.is_owned = false;
33455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
33459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
33460 LDKChannelTransactionParameters this_ptr_conv;
33461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33462 this_ptr_conv.is_owned = false;
33463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33464 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
33468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33469 LDKChannelTransactionParameters this_ptr_conv;
33470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33471 this_ptr_conv.is_owned = false;
33472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33473 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
33476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
33477 LDKChannelTransactionParameters this_ptr_conv;
33478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33479 this_ptr_conv.is_owned = false;
33480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33481 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
33482 uint64_t ret_ref = 0;
33483 if ((uint64_t)ret_var.inner > 4096) {
33484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33487 ret_ref = (uint64_t)ret_var.inner;
33488 if (ret_var.is_owned) {
33495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33496 LDKChannelTransactionParameters this_ptr_conv;
33497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33498 this_ptr_conv.is_owned = false;
33499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33500 LDKCounterpartyChannelTransactionParameters val_conv;
33501 val_conv.inner = (void*)(val & (~1));
33502 val_conv.is_owned = (val & 1) || (val == 0);
33503 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33504 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
33505 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
33508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33509 LDKChannelTransactionParameters this_ptr_conv;
33510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33511 this_ptr_conv.is_owned = false;
33512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33513 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
33514 uint64_t ret_ref = 0;
33515 if ((uint64_t)ret_var.inner > 4096) {
33516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33518 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33519 ret_ref = (uint64_t)ret_var.inner;
33520 if (ret_var.is_owned) {
33527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33528 LDKChannelTransactionParameters this_ptr_conv;
33529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33530 this_ptr_conv.is_owned = false;
33531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33532 LDKOutPoint val_conv;
33533 val_conv.inner = (void*)(val & (~1));
33534 val_conv.is_owned = (val & 1) || (val == 0);
33535 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33536 val_conv = OutPoint_clone(&val_conv);
33537 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
33540 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
33541 LDKChannelTransactionParameters this_ptr_conv;
33542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33543 this_ptr_conv.is_owned = false;
33544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33545 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
33549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
33550 LDKChannelTransactionParameters this_ptr_conv;
33551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33552 this_ptr_conv.is_owned = false;
33553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33554 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
33555 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
33558 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, jclass opt_anchors_arg) {
33559 LDKChannelPublicKeys holder_pubkeys_arg_conv;
33560 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
33561 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
33562 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
33563 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
33564 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
33565 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
33566 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
33567 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
33568 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
33569 LDKOutPoint funding_outpoint_arg_conv;
33570 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
33571 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
33572 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
33573 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
33574 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
33575 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, opt_anchors_arg_conv);
33576 uint64_t ret_ref = 0;
33577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33580 ret_ref = (uint64_t)ret_var.inner;
33581 if (ret_var.is_owned) {
33587 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
33588 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
33589 uint64_t ret_ref = 0;
33590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33593 ret_ref = (uint64_t)ret_var.inner;
33594 if (ret_var.is_owned) {
33599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33600 LDKChannelTransactionParameters arg_conv;
33601 arg_conv.inner = (void*)(arg & (~1));
33602 arg_conv.is_owned = false;
33603 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33604 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
33608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33609 LDKChannelTransactionParameters orig_conv;
33610 orig_conv.inner = (void*)(orig & (~1));
33611 orig_conv.is_owned = false;
33612 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33613 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
33614 uint64_t ret_ref = 0;
33615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33618 ret_ref = (uint64_t)ret_var.inner;
33619 if (ret_var.is_owned) {
33625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33626 LDKCounterpartyChannelTransactionParameters this_obj_conv;
33627 this_obj_conv.inner = (void*)(this_obj & (~1));
33628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33630 CounterpartyChannelTransactionParameters_free(this_obj_conv);
33633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
33634 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33636 this_ptr_conv.is_owned = false;
33637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33638 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
33639 uint64_t ret_ref = 0;
33640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33643 ret_ref = (uint64_t)ret_var.inner;
33644 if (ret_var.is_owned) {
33650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33651 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33653 this_ptr_conv.is_owned = false;
33654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655 LDKChannelPublicKeys val_conv;
33656 val_conv.inner = (void*)(val & (~1));
33657 val_conv.is_owned = (val & 1) || (val == 0);
33658 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33659 val_conv = ChannelPublicKeys_clone(&val_conv);
33660 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
33663 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33664 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33666 this_ptr_conv.is_owned = false;
33667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33668 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
33672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33673 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33675 this_ptr_conv.is_owned = false;
33676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33677 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
33680 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) {
33681 LDKChannelPublicKeys pubkeys_arg_conv;
33682 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
33683 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
33684 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
33685 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
33686 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
33687 uint64_t ret_ref = 0;
33688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33691 ret_ref = (uint64_t)ret_var.inner;
33692 if (ret_var.is_owned) {
33698 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
33699 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
33700 uint64_t ret_ref = 0;
33701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33704 ret_ref = (uint64_t)ret_var.inner;
33705 if (ret_var.is_owned) {
33710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33711 LDKCounterpartyChannelTransactionParameters arg_conv;
33712 arg_conv.inner = (void*)(arg & (~1));
33713 arg_conv.is_owned = false;
33714 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33715 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
33719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33720 LDKCounterpartyChannelTransactionParameters orig_conv;
33721 orig_conv.inner = (void*)(orig & (~1));
33722 orig_conv.is_owned = false;
33723 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33724 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
33725 uint64_t ret_ref = 0;
33726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33729 ret_ref = (uint64_t)ret_var.inner;
33730 if (ret_var.is_owned) {
33736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
33737 LDKChannelTransactionParameters this_arg_conv;
33738 this_arg_conv.inner = (void*)(this_arg & (~1));
33739 this_arg_conv.is_owned = false;
33740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33741 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
33745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
33746 LDKChannelTransactionParameters this_arg_conv;
33747 this_arg_conv.inner = (void*)(this_arg & (~1));
33748 this_arg_conv.is_owned = false;
33749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33750 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
33751 uint64_t ret_ref = 0;
33752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33755 ret_ref = (uint64_t)ret_var.inner;
33756 if (ret_var.is_owned) {
33762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
33763 LDKChannelTransactionParameters this_arg_conv;
33764 this_arg_conv.inner = (void*)(this_arg & (~1));
33765 this_arg_conv.is_owned = false;
33766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33767 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
33768 uint64_t ret_ref = 0;
33769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33772 ret_ref = (uint64_t)ret_var.inner;
33773 if (ret_var.is_owned) {
33779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
33780 LDKCounterpartyChannelTransactionParameters obj_conv;
33781 obj_conv.inner = (void*)(obj & (~1));
33782 obj_conv.is_owned = false;
33783 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33784 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
33785 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33786 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33787 CVec_u8Z_free(ret_var);
33791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33792 LDKu8slice ser_ref;
33793 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33794 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33795 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33796 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
33797 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33798 return (uint64_t)ret_conv;
33801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
33802 LDKChannelTransactionParameters obj_conv;
33803 obj_conv.inner = (void*)(obj & (~1));
33804 obj_conv.is_owned = false;
33805 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33806 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
33807 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33808 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33809 CVec_u8Z_free(ret_var);
33813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33814 LDKu8slice ser_ref;
33815 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33816 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33817 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
33818 *ret_conv = ChannelTransactionParameters_read(ser_ref);
33819 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33820 return (uint64_t)ret_conv;
33823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33824 LDKDirectedChannelTransactionParameters this_obj_conv;
33825 this_obj_conv.inner = (void*)(this_obj & (~1));
33826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33828 DirectedChannelTransactionParameters_free(this_obj_conv);
33831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
33832 LDKDirectedChannelTransactionParameters this_arg_conv;
33833 this_arg_conv.inner = (void*)(this_arg & (~1));
33834 this_arg_conv.is_owned = false;
33835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33836 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
33837 uint64_t ret_ref = 0;
33838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33841 ret_ref = (uint64_t)ret_var.inner;
33842 if (ret_var.is_owned) {
33848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
33849 LDKDirectedChannelTransactionParameters this_arg_conv;
33850 this_arg_conv.inner = (void*)(this_arg & (~1));
33851 this_arg_conv.is_owned = false;
33852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33853 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
33854 uint64_t ret_ref = 0;
33855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33858 ret_ref = (uint64_t)ret_var.inner;
33859 if (ret_var.is_owned) {
33865 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
33866 LDKDirectedChannelTransactionParameters this_arg_conv;
33867 this_arg_conv.inner = (void*)(this_arg & (~1));
33868 this_arg_conv.is_owned = false;
33869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33870 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
33874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
33875 LDKDirectedChannelTransactionParameters this_arg_conv;
33876 this_arg_conv.inner = (void*)(this_arg & (~1));
33877 this_arg_conv.is_owned = false;
33878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33879 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
33883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
33884 LDKDirectedChannelTransactionParameters this_arg_conv;
33885 this_arg_conv.inner = (void*)(this_arg & (~1));
33886 this_arg_conv.is_owned = false;
33887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33888 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
33889 uint64_t ret_ref = 0;
33890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33893 ret_ref = (uint64_t)ret_var.inner;
33894 if (ret_var.is_owned) {
33900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
33901 LDKDirectedChannelTransactionParameters this_arg_conv;
33902 this_arg_conv.inner = (void*)(this_arg & (~1));
33903 this_arg_conv.is_owned = false;
33904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33905 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
33909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33910 LDKHolderCommitmentTransaction this_obj_conv;
33911 this_obj_conv.inner = (void*)(this_obj & (~1));
33912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33914 HolderCommitmentTransaction_free(this_obj_conv);
33917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
33918 LDKHolderCommitmentTransaction this_ptr_conv;
33919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33920 this_ptr_conv.is_owned = false;
33921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33922 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
33927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33928 LDKHolderCommitmentTransaction this_ptr_conv;
33929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33930 this_ptr_conv.is_owned = false;
33931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33932 LDKSignature val_ref;
33933 CHECK((*env)->GetArrayLength(env, val) == 64);
33934 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33935 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
33938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
33939 LDKHolderCommitmentTransaction this_ptr_conv;
33940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33941 this_ptr_conv.is_owned = false;
33942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33943 LDKCVec_SignatureZ val_constr;
33944 val_constr.datalen = (*env)->GetArrayLength(env, val);
33945 if (val_constr.datalen > 0)
33946 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33948 val_constr.data = NULL;
33949 for (size_t i = 0; i < val_constr.datalen; i++) {
33950 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
33951 LDKSignature val_conv_8_ref;
33952 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
33953 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
33954 val_constr.data[i] = val_conv_8_ref;
33956 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
33959 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
33960 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
33961 uint64_t ret_ref = 0;
33962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33965 ret_ref = (uint64_t)ret_var.inner;
33966 if (ret_var.is_owned) {
33971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33972 LDKHolderCommitmentTransaction arg_conv;
33973 arg_conv.inner = (void*)(arg & (~1));
33974 arg_conv.is_owned = false;
33975 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33976 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
33980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33981 LDKHolderCommitmentTransaction orig_conv;
33982 orig_conv.inner = (void*)(orig & (~1));
33983 orig_conv.is_owned = false;
33984 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33985 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
33986 uint64_t ret_ref = 0;
33987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33990 ret_ref = (uint64_t)ret_var.inner;
33991 if (ret_var.is_owned) {
33997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
33998 LDKHolderCommitmentTransaction obj_conv;
33999 obj_conv.inner = (void*)(obj & (~1));
34000 obj_conv.is_owned = false;
34001 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34002 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
34003 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34004 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34005 CVec_u8Z_free(ret_var);
34009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34010 LDKu8slice ser_ref;
34011 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34012 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34013 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34014 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
34015 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34016 return (uint64_t)ret_conv;
34019 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) {
34020 LDKCommitmentTransaction commitment_tx_conv;
34021 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
34022 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
34023 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
34024 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
34025 LDKSignature counterparty_sig_ref;
34026 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
34027 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
34028 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
34029 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
34030 if (counterparty_htlc_sigs_constr.datalen > 0)
34031 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34033 counterparty_htlc_sigs_constr.data = NULL;
34034 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
34035 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
34036 LDKSignature counterparty_htlc_sigs_conv_8_ref;
34037 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
34038 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
34039 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
34041 LDKPublicKey holder_funding_key_ref;
34042 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
34043 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
34044 LDKPublicKey counterparty_funding_key_ref;
34045 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
34046 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
34047 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
34048 uint64_t ret_ref = 0;
34049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34052 ret_ref = (uint64_t)ret_var.inner;
34053 if (ret_var.is_owned) {
34059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34060 LDKBuiltCommitmentTransaction this_obj_conv;
34061 this_obj_conv.inner = (void*)(this_obj & (~1));
34062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34064 BuiltCommitmentTransaction_free(this_obj_conv);
34067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
34068 LDKBuiltCommitmentTransaction this_ptr_conv;
34069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34070 this_ptr_conv.is_owned = false;
34071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34072 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
34073 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34074 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34075 Transaction_free(ret_var);
34079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34080 LDKBuiltCommitmentTransaction this_ptr_conv;
34081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34082 this_ptr_conv.is_owned = false;
34083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34084 LDKTransaction val_ref;
34085 val_ref.datalen = (*env)->GetArrayLength(env, val);
34086 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
34087 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34088 val_ref.data_is_owned = true;
34089 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
34092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
34093 LDKBuiltCommitmentTransaction this_ptr_conv;
34094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34095 this_ptr_conv.is_owned = false;
34096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34097 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
34102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34103 LDKBuiltCommitmentTransaction this_ptr_conv;
34104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34105 this_ptr_conv.is_owned = false;
34106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34107 LDKThirtyTwoBytes val_ref;
34108 CHECK((*env)->GetArrayLength(env, val) == 32);
34109 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34110 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
34113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
34114 LDKTransaction transaction_arg_ref;
34115 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
34116 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
34117 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
34118 transaction_arg_ref.data_is_owned = true;
34119 LDKThirtyTwoBytes txid_arg_ref;
34120 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
34121 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
34122 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
34123 uint64_t ret_ref = 0;
34124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34127 ret_ref = (uint64_t)ret_var.inner;
34128 if (ret_var.is_owned) {
34134 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
34135 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
34136 uint64_t ret_ref = 0;
34137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34140 ret_ref = (uint64_t)ret_var.inner;
34141 if (ret_var.is_owned) {
34146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34147 LDKBuiltCommitmentTransaction arg_conv;
34148 arg_conv.inner = (void*)(arg & (~1));
34149 arg_conv.is_owned = false;
34150 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34151 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
34155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34156 LDKBuiltCommitmentTransaction orig_conv;
34157 orig_conv.inner = (void*)(orig & (~1));
34158 orig_conv.is_owned = false;
34159 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34160 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
34161 uint64_t ret_ref = 0;
34162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34165 ret_ref = (uint64_t)ret_var.inner;
34166 if (ret_var.is_owned) {
34172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
34173 LDKBuiltCommitmentTransaction obj_conv;
34174 obj_conv.inner = (void*)(obj & (~1));
34175 obj_conv.is_owned = false;
34176 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34177 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
34178 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34179 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34180 CVec_u8Z_free(ret_var);
34184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34185 LDKu8slice ser_ref;
34186 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34187 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34188 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34189 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
34190 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34191 return (uint64_t)ret_conv;
34194 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) {
34195 LDKBuiltCommitmentTransaction this_arg_conv;
34196 this_arg_conv.inner = (void*)(this_arg & (~1));
34197 this_arg_conv.is_owned = false;
34198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34199 LDKu8slice funding_redeemscript_ref;
34200 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
34201 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
34202 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34203 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
34204 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
34208 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) {
34209 LDKBuiltCommitmentTransaction this_arg_conv;
34210 this_arg_conv.inner = (void*)(this_arg & (~1));
34211 this_arg_conv.is_owned = false;
34212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34213 unsigned char funding_key_arr[32];
34214 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
34215 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
34216 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
34217 LDKu8slice funding_redeemscript_ref;
34218 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
34219 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
34220 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
34222 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
34226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34227 LDKClosingTransaction this_obj_conv;
34228 this_obj_conv.inner = (void*)(this_obj & (~1));
34229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34231 ClosingTransaction_free(this_obj_conv);
34234 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
34235 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
34236 uint64_t ret_ref = 0;
34237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34240 ret_ref = (uint64_t)ret_var.inner;
34241 if (ret_var.is_owned) {
34246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34247 LDKClosingTransaction arg_conv;
34248 arg_conv.inner = (void*)(arg & (~1));
34249 arg_conv.is_owned = false;
34250 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34251 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
34255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34256 LDKClosingTransaction orig_conv;
34257 orig_conv.inner = (void*)(orig & (~1));
34258 orig_conv.is_owned = false;
34259 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34260 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
34261 uint64_t ret_ref = 0;
34262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34265 ret_ref = (uint64_t)ret_var.inner;
34266 if (ret_var.is_owned) {
34272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
34273 LDKClosingTransaction o_conv;
34274 o_conv.inner = (void*)(o & (~1));
34275 o_conv.is_owned = false;
34276 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34277 int64_t ret_val = ClosingTransaction_hash(&o_conv);
34281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
34282 LDKCVec_u8Z to_holder_script_ref;
34283 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
34284 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
34285 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
34286 LDKCVec_u8Z to_counterparty_script_ref;
34287 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
34288 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
34289 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
34290 LDKOutPoint funding_outpoint_conv;
34291 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34292 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34293 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34294 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34295 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
34296 uint64_t ret_ref = 0;
34297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34300 ret_ref = (uint64_t)ret_var.inner;
34301 if (ret_var.is_owned) {
34307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
34308 LDKClosingTransaction this_arg_conv;
34309 this_arg_conv.inner = (void*)(this_arg & (~1));
34310 this_arg_conv.is_owned = false;
34311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34312 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
34313 uint64_t ret_ref = 0;
34314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34317 ret_ref = (uint64_t)ret_var.inner;
34318 if (ret_var.is_owned) {
34324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
34325 LDKClosingTransaction this_arg_conv;
34326 this_arg_conv.inner = (void*)(this_arg & (~1));
34327 this_arg_conv.is_owned = false;
34328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34329 LDKOutPoint funding_outpoint_conv;
34330 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34331 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34332 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34333 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34334 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34335 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
34336 return (uint64_t)ret_conv;
34339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
34340 LDKClosingTransaction this_arg_conv;
34341 this_arg_conv.inner = (void*)(this_arg & (~1));
34342 this_arg_conv.is_owned = false;
34343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34344 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
34348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
34349 LDKClosingTransaction this_arg_conv;
34350 this_arg_conv.inner = (void*)(this_arg & (~1));
34351 this_arg_conv.is_owned = false;
34352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34353 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
34357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
34358 LDKClosingTransaction this_arg_conv;
34359 this_arg_conv.inner = (void*)(this_arg & (~1));
34360 this_arg_conv.is_owned = false;
34361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34362 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
34363 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34364 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
34369 LDKClosingTransaction this_arg_conv;
34370 this_arg_conv.inner = (void*)(this_arg & (~1));
34371 this_arg_conv.is_owned = false;
34372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34373 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
34374 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34375 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34380 LDKTrustedClosingTransaction this_obj_conv;
34381 this_obj_conv.inner = (void*)(this_obj & (~1));
34382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34384 TrustedClosingTransaction_free(this_obj_conv);
34387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
34388 LDKTrustedClosingTransaction this_arg_conv;
34389 this_arg_conv.inner = (void*)(this_arg & (~1));
34390 this_arg_conv.is_owned = false;
34391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34392 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
34393 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34394 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34395 Transaction_free(ret_var);
34399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34400 LDKTrustedClosingTransaction this_arg_conv;
34401 this_arg_conv.inner = (void*)(this_arg & (~1));
34402 this_arg_conv.is_owned = false;
34403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34404 LDKu8slice funding_redeemscript_ref;
34405 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
34406 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
34407 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34408 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
34409 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
34413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34414 LDKTrustedClosingTransaction this_arg_conv;
34415 this_arg_conv.inner = (void*)(this_arg & (~1));
34416 this_arg_conv.is_owned = false;
34417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34418 unsigned char funding_key_arr[32];
34419 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
34420 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
34421 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
34422 LDKu8slice funding_redeemscript_ref;
34423 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
34424 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
34425 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
34427 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
34431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34432 LDKCommitmentTransaction this_obj_conv;
34433 this_obj_conv.inner = (void*)(this_obj & (~1));
34434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34436 CommitmentTransaction_free(this_obj_conv);
34439 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
34440 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
34441 uint64_t ret_ref = 0;
34442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34445 ret_ref = (uint64_t)ret_var.inner;
34446 if (ret_var.is_owned) {
34451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34452 LDKCommitmentTransaction arg_conv;
34453 arg_conv.inner = (void*)(arg & (~1));
34454 arg_conv.is_owned = false;
34455 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34456 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
34460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34461 LDKCommitmentTransaction orig_conv;
34462 orig_conv.inner = (void*)(orig & (~1));
34463 orig_conv.is_owned = false;
34464 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34465 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
34466 uint64_t ret_ref = 0;
34467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34470 ret_ref = (uint64_t)ret_var.inner;
34471 if (ret_var.is_owned) {
34477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
34478 LDKCommitmentTransaction obj_conv;
34479 obj_conv.inner = (void*)(obj & (~1));
34480 obj_conv.is_owned = false;
34481 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34482 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
34483 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34484 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34485 CVec_u8Z_free(ret_var);
34489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34490 LDKu8slice ser_ref;
34491 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34492 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34493 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34494 *ret_conv = CommitmentTransaction_read(ser_ref);
34495 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34496 return (uint64_t)ret_conv;
34499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
34500 LDKCommitmentTransaction this_arg_conv;
34501 this_arg_conv.inner = (void*)(this_arg & (~1));
34502 this_arg_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34504 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
34508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
34509 LDKCommitmentTransaction this_arg_conv;
34510 this_arg_conv.inner = (void*)(this_arg & (~1));
34511 this_arg_conv.is_owned = false;
34512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34513 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
34517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
34518 LDKCommitmentTransaction this_arg_conv;
34519 this_arg_conv.inner = (void*)(this_arg & (~1));
34520 this_arg_conv.is_owned = false;
34521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34522 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
34526 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
34527 LDKCommitmentTransaction this_arg_conv;
34528 this_arg_conv.inner = (void*)(this_arg & (~1));
34529 this_arg_conv.is_owned = false;
34530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34531 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
34535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
34536 LDKCommitmentTransaction this_arg_conv;
34537 this_arg_conv.inner = (void*)(this_arg & (~1));
34538 this_arg_conv.is_owned = false;
34539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34540 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
34541 uint64_t ret_ref = 0;
34542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34545 ret_ref = (uint64_t)ret_var.inner;
34546 if (ret_var.is_owned) {
34552 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) {
34553 LDKCommitmentTransaction this_arg_conv;
34554 this_arg_conv.inner = (void*)(this_arg & (~1));
34555 this_arg_conv.is_owned = false;
34556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34557 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34558 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34559 channel_parameters_conv.is_owned = false;
34560 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34561 LDKChannelPublicKeys broadcaster_keys_conv;
34562 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34563 broadcaster_keys_conv.is_owned = false;
34564 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34565 LDKChannelPublicKeys countersignatory_keys_conv;
34566 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34567 countersignatory_keys_conv.is_owned = false;
34568 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34569 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34570 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
34571 return (uint64_t)ret_conv;
34574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34575 LDKTrustedCommitmentTransaction this_obj_conv;
34576 this_obj_conv.inner = (void*)(this_obj & (~1));
34577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34579 TrustedCommitmentTransaction_free(this_obj_conv);
34582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
34583 LDKTrustedCommitmentTransaction this_arg_conv;
34584 this_arg_conv.inner = (void*)(this_arg & (~1));
34585 this_arg_conv.is_owned = false;
34586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34587 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34588 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
34592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
34593 LDKTrustedCommitmentTransaction this_arg_conv;
34594 this_arg_conv.inner = (void*)(this_arg & (~1));
34595 this_arg_conv.is_owned = false;
34596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34597 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
34598 uint64_t ret_ref = 0;
34599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34602 ret_ref = (uint64_t)ret_var.inner;
34603 if (ret_var.is_owned) {
34609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
34610 LDKTrustedCommitmentTransaction this_arg_conv;
34611 this_arg_conv.inner = (void*)(this_arg & (~1));
34612 this_arg_conv.is_owned = false;
34613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34614 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
34615 uint64_t ret_ref = 0;
34616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34619 ret_ref = (uint64_t)ret_var.inner;
34620 if (ret_var.is_owned) {
34626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
34627 LDKTrustedCommitmentTransaction this_arg_conv;
34628 this_arg_conv.inner = (void*)(this_arg & (~1));
34629 this_arg_conv.is_owned = false;
34630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34631 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
34635 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) {
34636 LDKTrustedCommitmentTransaction this_arg_conv;
34637 this_arg_conv.inner = (void*)(this_arg & (~1));
34638 this_arg_conv.is_owned = false;
34639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34640 unsigned char htlc_base_key_arr[32];
34641 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
34642 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
34643 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
34644 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34645 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34646 channel_parameters_conv.is_owned = false;
34647 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34648 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
34649 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
34650 return (uint64_t)ret_conv;
34653 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) {
34654 LDKPublicKey broadcaster_payment_basepoint_ref;
34655 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
34656 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
34657 LDKPublicKey countersignatory_payment_basepoint_ref;
34658 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
34659 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
34660 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
34664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34665 LDKInitFeatures a_conv;
34666 a_conv.inner = (void*)(a & (~1));
34667 a_conv.is_owned = false;
34668 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34669 LDKInitFeatures b_conv;
34670 b_conv.inner = (void*)(b & (~1));
34671 b_conv.is_owned = false;
34672 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34673 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
34677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34678 LDKNodeFeatures a_conv;
34679 a_conv.inner = (void*)(a & (~1));
34680 a_conv.is_owned = false;
34681 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34682 LDKNodeFeatures b_conv;
34683 b_conv.inner = (void*)(b & (~1));
34684 b_conv.is_owned = false;
34685 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34686 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
34690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34691 LDKChannelFeatures a_conv;
34692 a_conv.inner = (void*)(a & (~1));
34693 a_conv.is_owned = false;
34694 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34695 LDKChannelFeatures b_conv;
34696 b_conv.inner = (void*)(b & (~1));
34697 b_conv.is_owned = false;
34698 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34699 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
34703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34704 LDKInvoiceFeatures a_conv;
34705 a_conv.inner = (void*)(a & (~1));
34706 a_conv.is_owned = false;
34707 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34708 LDKInvoiceFeatures b_conv;
34709 b_conv.inner = (void*)(b & (~1));
34710 b_conv.is_owned = false;
34711 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34712 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
34716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34717 LDKChannelTypeFeatures a_conv;
34718 a_conv.inner = (void*)(a & (~1));
34719 a_conv.is_owned = false;
34720 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34721 LDKChannelTypeFeatures b_conv;
34722 b_conv.inner = (void*)(b & (~1));
34723 b_conv.is_owned = false;
34724 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34725 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
34729 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
34730 LDKInitFeatures ret_var = InitFeatures_clone(arg);
34731 uint64_t ret_ref = 0;
34732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34735 ret_ref = (uint64_t)ret_var.inner;
34736 if (ret_var.is_owned) {
34741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34742 LDKInitFeatures arg_conv;
34743 arg_conv.inner = (void*)(arg & (~1));
34744 arg_conv.is_owned = false;
34745 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34746 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
34750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34751 LDKInitFeatures orig_conv;
34752 orig_conv.inner = (void*)(orig & (~1));
34753 orig_conv.is_owned = false;
34754 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34755 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
34756 uint64_t ret_ref = 0;
34757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34760 ret_ref = (uint64_t)ret_var.inner;
34761 if (ret_var.is_owned) {
34767 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
34768 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
34769 uint64_t ret_ref = 0;
34770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34773 ret_ref = (uint64_t)ret_var.inner;
34774 if (ret_var.is_owned) {
34779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34780 LDKNodeFeatures arg_conv;
34781 arg_conv.inner = (void*)(arg & (~1));
34782 arg_conv.is_owned = false;
34783 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34784 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
34788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34789 LDKNodeFeatures orig_conv;
34790 orig_conv.inner = (void*)(orig & (~1));
34791 orig_conv.is_owned = false;
34792 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34793 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
34794 uint64_t ret_ref = 0;
34795 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34796 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34798 ret_ref = (uint64_t)ret_var.inner;
34799 if (ret_var.is_owned) {
34805 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
34806 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
34807 uint64_t ret_ref = 0;
34808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34811 ret_ref = (uint64_t)ret_var.inner;
34812 if (ret_var.is_owned) {
34817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34818 LDKChannelFeatures arg_conv;
34819 arg_conv.inner = (void*)(arg & (~1));
34820 arg_conv.is_owned = false;
34821 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34822 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
34826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34827 LDKChannelFeatures orig_conv;
34828 orig_conv.inner = (void*)(orig & (~1));
34829 orig_conv.is_owned = false;
34830 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34831 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
34832 uint64_t ret_ref = 0;
34833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34836 ret_ref = (uint64_t)ret_var.inner;
34837 if (ret_var.is_owned) {
34843 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
34844 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
34845 uint64_t ret_ref = 0;
34846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34849 ret_ref = (uint64_t)ret_var.inner;
34850 if (ret_var.is_owned) {
34855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34856 LDKInvoiceFeatures arg_conv;
34857 arg_conv.inner = (void*)(arg & (~1));
34858 arg_conv.is_owned = false;
34859 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34860 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
34864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34865 LDKInvoiceFeatures orig_conv;
34866 orig_conv.inner = (void*)(orig & (~1));
34867 orig_conv.is_owned = false;
34868 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34869 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
34870 uint64_t ret_ref = 0;
34871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34873 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34874 ret_ref = (uint64_t)ret_var.inner;
34875 if (ret_var.is_owned) {
34881 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
34882 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
34883 uint64_t ret_ref = 0;
34884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34887 ret_ref = (uint64_t)ret_var.inner;
34888 if (ret_var.is_owned) {
34893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34894 LDKChannelTypeFeatures arg_conv;
34895 arg_conv.inner = (void*)(arg & (~1));
34896 arg_conv.is_owned = false;
34897 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34898 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
34902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34903 LDKChannelTypeFeatures orig_conv;
34904 orig_conv.inner = (void*)(orig & (~1));
34905 orig_conv.is_owned = false;
34906 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34907 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
34908 uint64_t ret_ref = 0;
34909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34912 ret_ref = (uint64_t)ret_var.inner;
34913 if (ret_var.is_owned) {
34919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34920 LDKInitFeatures this_obj_conv;
34921 this_obj_conv.inner = (void*)(this_obj & (~1));
34922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34924 InitFeatures_free(this_obj_conv);
34927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34928 LDKNodeFeatures this_obj_conv;
34929 this_obj_conv.inner = (void*)(this_obj & (~1));
34930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34932 NodeFeatures_free(this_obj_conv);
34935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34936 LDKChannelFeatures this_obj_conv;
34937 this_obj_conv.inner = (void*)(this_obj & (~1));
34938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34940 ChannelFeatures_free(this_obj_conv);
34943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34944 LDKInvoiceFeatures this_obj_conv;
34945 this_obj_conv.inner = (void*)(this_obj & (~1));
34946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34948 InvoiceFeatures_free(this_obj_conv);
34951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34952 LDKChannelTypeFeatures this_obj_conv;
34953 this_obj_conv.inner = (void*)(this_obj & (~1));
34954 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34956 ChannelTypeFeatures_free(this_obj_conv);
34959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
34960 LDKInitFeatures ret_var = InitFeatures_empty();
34961 uint64_t ret_ref = 0;
34962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34965 ret_ref = (uint64_t)ret_var.inner;
34966 if (ret_var.is_owned) {
34972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
34973 LDKInitFeatures ret_var = InitFeatures_known();
34974 uint64_t ret_ref = 0;
34975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34978 ret_ref = (uint64_t)ret_var.inner;
34979 if (ret_var.is_owned) {
34985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
34986 LDKInitFeatures this_arg_conv;
34987 this_arg_conv.inner = (void*)(this_arg & (~1));
34988 this_arg_conv.is_owned = false;
34989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34990 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
34994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
34995 LDKNodeFeatures ret_var = NodeFeatures_empty();
34996 uint64_t ret_ref = 0;
34997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35000 ret_ref = (uint64_t)ret_var.inner;
35001 if (ret_var.is_owned) {
35007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
35008 LDKNodeFeatures ret_var = NodeFeatures_known();
35009 uint64_t ret_ref = 0;
35010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35013 ret_ref = (uint64_t)ret_var.inner;
35014 if (ret_var.is_owned) {
35020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
35021 LDKNodeFeatures this_arg_conv;
35022 this_arg_conv.inner = (void*)(this_arg & (~1));
35023 this_arg_conv.is_owned = false;
35024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35025 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
35029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
35030 LDKChannelFeatures ret_var = ChannelFeatures_empty();
35031 uint64_t ret_ref = 0;
35032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35035 ret_ref = (uint64_t)ret_var.inner;
35036 if (ret_var.is_owned) {
35042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
35043 LDKChannelFeatures ret_var = ChannelFeatures_known();
35044 uint64_t ret_ref = 0;
35045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35048 ret_ref = (uint64_t)ret_var.inner;
35049 if (ret_var.is_owned) {
35055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
35056 LDKChannelFeatures this_arg_conv;
35057 this_arg_conv.inner = (void*)(this_arg & (~1));
35058 this_arg_conv.is_owned = false;
35059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35060 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
35064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
35065 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
35066 uint64_t ret_ref = 0;
35067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35070 ret_ref = (uint64_t)ret_var.inner;
35071 if (ret_var.is_owned) {
35077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
35078 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
35079 uint64_t ret_ref = 0;
35080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35083 ret_ref = (uint64_t)ret_var.inner;
35084 if (ret_var.is_owned) {
35090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
35091 LDKInvoiceFeatures this_arg_conv;
35092 this_arg_conv.inner = (void*)(this_arg & (~1));
35093 this_arg_conv.is_owned = false;
35094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35095 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
35099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
35100 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
35101 uint64_t ret_ref = 0;
35102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35105 ret_ref = (uint64_t)ret_var.inner;
35106 if (ret_var.is_owned) {
35112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
35113 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
35114 uint64_t ret_ref = 0;
35115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35118 ret_ref = (uint64_t)ret_var.inner;
35119 if (ret_var.is_owned) {
35125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
35126 LDKChannelTypeFeatures this_arg_conv;
35127 this_arg_conv.inner = (void*)(this_arg & (~1));
35128 this_arg_conv.is_owned = false;
35129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35130 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
35134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35135 LDKInitFeatures obj_conv;
35136 obj_conv.inner = (void*)(obj & (~1));
35137 obj_conv.is_owned = false;
35138 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35139 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
35140 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35141 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35142 CVec_u8Z_free(ret_var);
35146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35147 LDKu8slice ser_ref;
35148 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35149 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35150 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
35151 *ret_conv = InitFeatures_read(ser_ref);
35152 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35153 return (uint64_t)ret_conv;
35156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35157 LDKChannelFeatures obj_conv;
35158 obj_conv.inner = (void*)(obj & (~1));
35159 obj_conv.is_owned = false;
35160 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35161 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
35162 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35163 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35164 CVec_u8Z_free(ret_var);
35168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35169 LDKu8slice ser_ref;
35170 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35171 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35172 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
35173 *ret_conv = ChannelFeatures_read(ser_ref);
35174 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35175 return (uint64_t)ret_conv;
35178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35179 LDKNodeFeatures obj_conv;
35180 obj_conv.inner = (void*)(obj & (~1));
35181 obj_conv.is_owned = false;
35182 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35183 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
35184 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35185 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35186 CVec_u8Z_free(ret_var);
35190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35191 LDKu8slice ser_ref;
35192 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35193 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35194 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
35195 *ret_conv = NodeFeatures_read(ser_ref);
35196 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35197 return (uint64_t)ret_conv;
35200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35201 LDKInvoiceFeatures obj_conv;
35202 obj_conv.inner = (void*)(obj & (~1));
35203 obj_conv.is_owned = false;
35204 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35205 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
35206 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35207 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35208 CVec_u8Z_free(ret_var);
35212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35213 LDKu8slice ser_ref;
35214 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35215 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35216 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
35217 *ret_conv = InvoiceFeatures_read(ser_ref);
35218 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35219 return (uint64_t)ret_conv;
35222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35223 LDKChannelTypeFeatures obj_conv;
35224 obj_conv.inner = (void*)(obj & (~1));
35225 obj_conv.is_owned = false;
35226 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35227 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
35228 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35229 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35230 CVec_u8Z_free(ret_var);
35234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35235 LDKu8slice ser_ref;
35236 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35237 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35238 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
35239 *ret_conv = ChannelTypeFeatures_read(ser_ref);
35240 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35241 return (uint64_t)ret_conv;
35244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35245 LDKShutdownScript this_obj_conv;
35246 this_obj_conv.inner = (void*)(this_obj & (~1));
35247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35249 ShutdownScript_free(this_obj_conv);
35252 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
35253 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
35254 uint64_t ret_ref = 0;
35255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35258 ret_ref = (uint64_t)ret_var.inner;
35259 if (ret_var.is_owned) {
35264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35265 LDKShutdownScript arg_conv;
35266 arg_conv.inner = (void*)(arg & (~1));
35267 arg_conv.is_owned = false;
35268 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35269 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
35273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35274 LDKShutdownScript orig_conv;
35275 orig_conv.inner = (void*)(orig & (~1));
35276 orig_conv.is_owned = false;
35277 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35278 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
35279 uint64_t ret_ref = 0;
35280 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35281 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35283 ret_ref = (uint64_t)ret_var.inner;
35284 if (ret_var.is_owned) {
35290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35291 LDKInvalidShutdownScript this_obj_conv;
35292 this_obj_conv.inner = (void*)(this_obj & (~1));
35293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35295 InvalidShutdownScript_free(this_obj_conv);
35298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
35299 LDKInvalidShutdownScript this_ptr_conv;
35300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35301 this_ptr_conv.is_owned = false;
35302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35303 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
35304 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35305 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35310 LDKInvalidShutdownScript this_ptr_conv;
35311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35312 this_ptr_conv.is_owned = false;
35313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35314 LDKCVec_u8Z val_ref;
35315 val_ref.datalen = (*env)->GetArrayLength(env, val);
35316 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35317 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
35318 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
35321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
35322 LDKCVec_u8Z script_arg_ref;
35323 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
35324 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35325 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
35326 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
35327 uint64_t ret_ref = 0;
35328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35331 ret_ref = (uint64_t)ret_var.inner;
35332 if (ret_var.is_owned) {
35338 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
35339 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
35340 uint64_t ret_ref = 0;
35341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35344 ret_ref = (uint64_t)ret_var.inner;
35345 if (ret_var.is_owned) {
35350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35351 LDKInvalidShutdownScript arg_conv;
35352 arg_conv.inner = (void*)(arg & (~1));
35353 arg_conv.is_owned = false;
35354 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35355 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
35359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35360 LDKInvalidShutdownScript orig_conv;
35361 orig_conv.inner = (void*)(orig & (~1));
35362 orig_conv.is_owned = false;
35363 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35364 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
35365 uint64_t ret_ref = 0;
35366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35369 ret_ref = (uint64_t)ret_var.inner;
35370 if (ret_var.is_owned) {
35376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
35377 LDKShutdownScript obj_conv;
35378 obj_conv.inner = (void*)(obj & (~1));
35379 obj_conv.is_owned = false;
35380 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35381 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
35382 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35383 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35384 CVec_u8Z_free(ret_var);
35388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35389 LDKu8slice ser_ref;
35390 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35391 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35392 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
35393 *ret_conv = ShutdownScript_read(ser_ref);
35394 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35395 return (uint64_t)ret_conv;
35398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
35399 unsigned char pubkey_hash_arr[20];
35400 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
35401 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
35402 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
35403 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
35404 uint64_t ret_ref = 0;
35405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35408 ret_ref = (uint64_t)ret_var.inner;
35409 if (ret_var.is_owned) {
35415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
35416 unsigned char script_hash_arr[32];
35417 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
35418 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
35419 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
35420 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
35421 uint64_t ret_ref = 0;
35422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35425 ret_ref = (uint64_t)ret_var.inner;
35426 if (ret_var.is_owned) {
35432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
35433 LDKu8slice program_ref;
35434 program_ref.datalen = (*env)->GetArrayLength(env, program);
35435 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
35436 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
35437 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
35438 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
35439 return (uint64_t)ret_conv;
35442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
35443 LDKShutdownScript this_arg_conv;
35444 this_arg_conv.inner = (void*)(this_arg & (~1));
35445 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35447 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
35448 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
35449 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35450 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35451 CVec_u8Z_free(ret_var);
35455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
35456 LDKShutdownScript this_arg_conv;
35457 this_arg_conv.inner = (void*)(this_arg & (~1));
35458 this_arg_conv.is_owned = false;
35459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35460 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35461 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
35465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
35466 LDKShutdownScript this_arg_conv;
35467 this_arg_conv.inner = (void*)(this_arg & (~1));
35468 this_arg_conv.is_owned = false;
35469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35470 LDKInitFeatures features_conv;
35471 features_conv.inner = (void*)(features & (~1));
35472 features_conv.is_owned = false;
35473 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
35474 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
35478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35479 if ((this_ptr & 1) != 0) return;
35480 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35481 CHECK_ACCESS(this_ptr_ptr);
35482 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
35483 FREE((void*)this_ptr);
35484 CustomMessageReader_free(this_ptr_conv);
35487 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
35488 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35489 *ret_ret = Type_clone(arg);
35490 return (uint64_t)ret_ret;
35492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35493 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
35494 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
35495 LDKType* arg_conv = (LDKType*)arg_ptr;
35496 int64_t ret_val = Type_clone_ptr(arg_conv);
35500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35501 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
35502 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
35503 LDKType* orig_conv = (LDKType*)orig_ptr;
35504 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35505 *ret_ret = Type_clone(orig_conv);
35506 return (uint64_t)ret_ret;
35509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35510 if ((this_ptr & 1) != 0) return;
35511 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35512 CHECK_ACCESS(this_ptr_ptr);
35513 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
35514 FREE((void*)this_ptr);
35515 Type_free(this_ptr_conv);
35518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35519 LDKNodeId this_obj_conv;
35520 this_obj_conv.inner = (void*)(this_obj & (~1));
35521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35523 NodeId_free(this_obj_conv);
35526 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
35527 LDKNodeId ret_var = NodeId_clone(arg);
35528 uint64_t ret_ref = 0;
35529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35532 ret_ref = (uint64_t)ret_var.inner;
35533 if (ret_var.is_owned) {
35538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35539 LDKNodeId arg_conv;
35540 arg_conv.inner = (void*)(arg & (~1));
35541 arg_conv.is_owned = false;
35542 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35543 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
35547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35548 LDKNodeId orig_conv;
35549 orig_conv.inner = (void*)(orig & (~1));
35550 orig_conv.is_owned = false;
35551 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35552 LDKNodeId ret_var = NodeId_clone(&orig_conv);
35553 uint64_t ret_ref = 0;
35554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35557 ret_ref = (uint64_t)ret_var.inner;
35558 if (ret_var.is_owned) {
35564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
35565 LDKPublicKey pubkey_ref;
35566 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
35567 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
35568 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
35569 uint64_t ret_ref = 0;
35570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35573 ret_ref = (uint64_t)ret_var.inner;
35574 if (ret_var.is_owned) {
35580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
35581 LDKNodeId this_arg_conv;
35582 this_arg_conv.inner = (void*)(this_arg & (~1));
35583 this_arg_conv.is_owned = false;
35584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35585 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
35586 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35587 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
35593 o_conv.inner = (void*)(o & (~1));
35594 o_conv.is_owned = false;
35595 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35596 int64_t ret_val = NodeId_hash(&o_conv);
35600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
35601 LDKNodeId obj_conv;
35602 obj_conv.inner = (void*)(obj & (~1));
35603 obj_conv.is_owned = false;
35604 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35605 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
35606 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35607 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35608 CVec_u8Z_free(ret_var);
35612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35613 LDKu8slice ser_ref;
35614 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35615 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35616 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
35617 *ret_conv = NodeId_read(ser_ref);
35618 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35619 return (uint64_t)ret_conv;
35622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35623 LDKNetworkGraph this_obj_conv;
35624 this_obj_conv.inner = (void*)(this_obj & (~1));
35625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35627 NetworkGraph_free(this_obj_conv);
35630 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
35631 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
35632 uint64_t ret_ref = 0;
35633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35636 ret_ref = (uint64_t)ret_var.inner;
35637 if (ret_var.is_owned) {
35642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35643 LDKNetworkGraph arg_conv;
35644 arg_conv.inner = (void*)(arg & (~1));
35645 arg_conv.is_owned = false;
35646 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35647 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
35651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35652 LDKNetworkGraph orig_conv;
35653 orig_conv.inner = (void*)(orig & (~1));
35654 orig_conv.is_owned = false;
35655 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35656 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
35657 uint64_t ret_ref = 0;
35658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35661 ret_ref = (uint64_t)ret_var.inner;
35662 if (ret_var.is_owned) {
35668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35669 LDKReadOnlyNetworkGraph this_obj_conv;
35670 this_obj_conv.inner = (void*)(this_obj & (~1));
35671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35673 ReadOnlyNetworkGraph_free(this_obj_conv);
35676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35677 if ((this_ptr & 1) != 0) return;
35678 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35679 CHECK_ACCESS(this_ptr_ptr);
35680 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
35681 FREE((void*)this_ptr);
35682 NetworkUpdate_free(this_ptr_conv);
35685 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
35686 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35687 *ret_copy = NetworkUpdate_clone(arg);
35688 uint64_t ret_ref = (uint64_t)ret_copy;
35691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35692 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
35693 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
35697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35698 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
35699 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35700 *ret_copy = NetworkUpdate_clone(orig_conv);
35701 uint64_t ret_ref = (uint64_t)ret_copy;
35705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
35706 LDKChannelUpdate msg_conv;
35707 msg_conv.inner = (void*)(msg & (~1));
35708 msg_conv.is_owned = (msg & 1) || (msg == 0);
35709 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35710 msg_conv = ChannelUpdate_clone(&msg_conv);
35711 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35712 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
35713 uint64_t ret_ref = (uint64_t)ret_copy;
35717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
35718 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35719 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
35720 uint64_t ret_ref = (uint64_t)ret_copy;
35724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
35725 LDKPublicKey node_id_ref;
35726 CHECK((*env)->GetArrayLength(env, node_id) == 33);
35727 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
35728 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35729 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
35730 uint64_t ret_ref = (uint64_t)ret_copy;
35734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35735 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
35736 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
35737 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35738 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35739 CVec_u8Z_free(ret_var);
35743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35744 LDKu8slice ser_ref;
35745 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35746 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35747 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
35748 *ret_conv = NetworkUpdate_read(ser_ref);
35749 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35750 return (uint64_t)ret_conv;
35753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35754 LDKNetGraphMsgHandler this_arg_conv;
35755 this_arg_conv.inner = (void*)(this_arg & (~1));
35756 this_arg_conv.is_owned = false;
35757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35758 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
35759 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
35760 return (uint64_t)ret_ret;
35763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35764 LDKNetGraphMsgHandler this_obj_conv;
35765 this_obj_conv.inner = (void*)(this_obj & (~1));
35766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35768 NetGraphMsgHandler_free(this_obj_conv);
35771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
35772 LDKNetworkGraph network_graph_conv;
35773 network_graph_conv.inner = (void*)(network_graph & (~1));
35774 network_graph_conv.is_owned = false;
35775 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
35776 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
35777 CHECK_ACCESS(chain_access_ptr);
35778 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35779 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
35780 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35781 // Manually implement clone for Java trait instances
35782 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
35783 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35784 LDKAccess_JCalls_cloned(&chain_access_conv.some);
35787 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
35788 CHECK_ACCESS(logger_ptr);
35789 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35790 if (logger_conv.free == LDKLogger_JCalls_free) {
35791 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35792 LDKLogger_JCalls_cloned(&logger_conv);
35794 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
35795 uint64_t ret_ref = 0;
35796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35799 ret_ref = (uint64_t)ret_var.inner;
35800 if (ret_var.is_owned) {
35806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
35807 LDKNetGraphMsgHandler this_arg_conv;
35808 this_arg_conv.inner = (void*)(this_arg & (~1));
35809 this_arg_conv.is_owned = false;
35810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35811 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
35812 CHECK_ACCESS(chain_access_ptr);
35813 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35814 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
35815 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35816 // Manually implement clone for Java trait instances
35817 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
35818 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35819 LDKAccess_JCalls_cloned(&chain_access_conv.some);
35822 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
35825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35826 LDKNetGraphMsgHandler this_arg_conv;
35827 this_arg_conv.inner = (void*)(this_arg & (~1));
35828 this_arg_conv.is_owned = false;
35829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35830 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35831 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
35832 return (uint64_t)ret_ret;
35835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35836 LDKNetGraphMsgHandler this_arg_conv;
35837 this_arg_conv.inner = (void*)(this_arg & (~1));
35838 this_arg_conv.is_owned = false;
35839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35840 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35841 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
35842 return (uint64_t)ret_ret;
35845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35846 LDKDirectionalChannelInfo this_obj_conv;
35847 this_obj_conv.inner = (void*)(this_obj & (~1));
35848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35850 DirectionalChannelInfo_free(this_obj_conv);
35853 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
35854 LDKDirectionalChannelInfo this_ptr_conv;
35855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35856 this_ptr_conv.is_owned = false;
35857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35858 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
35862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35863 LDKDirectionalChannelInfo this_ptr_conv;
35864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35865 this_ptr_conv.is_owned = false;
35866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35867 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
35870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
35871 LDKDirectionalChannelInfo this_ptr_conv;
35872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35873 this_ptr_conv.is_owned = false;
35874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35875 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
35879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35880 LDKDirectionalChannelInfo this_ptr_conv;
35881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35882 this_ptr_conv.is_owned = false;
35883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35884 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
35887 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
35888 LDKDirectionalChannelInfo this_ptr_conv;
35889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35890 this_ptr_conv.is_owned = false;
35891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35892 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
35896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35897 LDKDirectionalChannelInfo this_ptr_conv;
35898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35899 this_ptr_conv.is_owned = false;
35900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35901 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
35904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35905 LDKDirectionalChannelInfo this_ptr_conv;
35906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35907 this_ptr_conv.is_owned = false;
35908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35909 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
35913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35914 LDKDirectionalChannelInfo this_ptr_conv;
35915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35916 this_ptr_conv.is_owned = false;
35917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35918 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
35921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35922 LDKDirectionalChannelInfo this_ptr_conv;
35923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35924 this_ptr_conv.is_owned = false;
35925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35926 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35927 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
35928 uint64_t ret_ref = (uint64_t)ret_copy;
35932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35933 LDKDirectionalChannelInfo this_ptr_conv;
35934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35935 this_ptr_conv.is_owned = false;
35936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35937 void* val_ptr = (void*)(((uint64_t)val) & ~1);
35938 CHECK_ACCESS(val_ptr);
35939 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
35940 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
35941 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
35944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
35945 LDKDirectionalChannelInfo this_ptr_conv;
35946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35947 this_ptr_conv.is_owned = false;
35948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35949 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
35950 uint64_t ret_ref = 0;
35951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35954 ret_ref = (uint64_t)ret_var.inner;
35955 if (ret_var.is_owned) {
35961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35962 LDKDirectionalChannelInfo this_ptr_conv;
35963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35964 this_ptr_conv.is_owned = false;
35965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35966 LDKRoutingFees val_conv;
35967 val_conv.inner = (void*)(val & (~1));
35968 val_conv.is_owned = (val & 1) || (val == 0);
35969 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35970 val_conv = RoutingFees_clone(&val_conv);
35971 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
35974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
35975 LDKDirectionalChannelInfo this_ptr_conv;
35976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35977 this_ptr_conv.is_owned = false;
35978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35979 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
35980 uint64_t ret_ref = 0;
35981 if ((uint64_t)ret_var.inner > 4096) {
35982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35985 ret_ref = (uint64_t)ret_var.inner;
35986 if (ret_var.is_owned) {
35993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35994 LDKDirectionalChannelInfo this_ptr_conv;
35995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35996 this_ptr_conv.is_owned = false;
35997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35998 LDKChannelUpdate val_conv;
35999 val_conv.inner = (void*)(val & (~1));
36000 val_conv.is_owned = (val & 1) || (val == 0);
36001 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36002 val_conv = ChannelUpdate_clone(&val_conv);
36003 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
36006 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) {
36007 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
36008 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
36009 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
36010 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
36011 LDKRoutingFees fees_arg_conv;
36012 fees_arg_conv.inner = (void*)(fees_arg & (~1));
36013 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
36014 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
36015 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
36016 LDKChannelUpdate last_update_message_arg_conv;
36017 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
36018 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
36019 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
36020 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
36021 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);
36022 uint64_t ret_ref = 0;
36023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36026 ret_ref = (uint64_t)ret_var.inner;
36027 if (ret_var.is_owned) {
36033 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
36034 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
36035 uint64_t ret_ref = 0;
36036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36039 ret_ref = (uint64_t)ret_var.inner;
36040 if (ret_var.is_owned) {
36045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36046 LDKDirectionalChannelInfo arg_conv;
36047 arg_conv.inner = (void*)(arg & (~1));
36048 arg_conv.is_owned = false;
36049 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36050 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
36054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36055 LDKDirectionalChannelInfo orig_conv;
36056 orig_conv.inner = (void*)(orig & (~1));
36057 orig_conv.is_owned = false;
36058 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36059 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
36060 uint64_t ret_ref = 0;
36061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36064 ret_ref = (uint64_t)ret_var.inner;
36065 if (ret_var.is_owned) {
36071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
36072 LDKDirectionalChannelInfo obj_conv;
36073 obj_conv.inner = (void*)(obj & (~1));
36074 obj_conv.is_owned = false;
36075 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36076 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
36077 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36078 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36079 CVec_u8Z_free(ret_var);
36083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36084 LDKu8slice ser_ref;
36085 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36086 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36087 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
36088 *ret_conv = DirectionalChannelInfo_read(ser_ref);
36089 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36090 return (uint64_t)ret_conv;
36093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36094 LDKChannelInfo this_obj_conv;
36095 this_obj_conv.inner = (void*)(this_obj & (~1));
36096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36098 ChannelInfo_free(this_obj_conv);
36101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
36102 LDKChannelInfo this_ptr_conv;
36103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36104 this_ptr_conv.is_owned = false;
36105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36106 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
36107 uint64_t ret_ref = 0;
36108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36111 ret_ref = (uint64_t)ret_var.inner;
36112 if (ret_var.is_owned) {
36118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36119 LDKChannelInfo this_ptr_conv;
36120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36121 this_ptr_conv.is_owned = false;
36122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36123 LDKChannelFeatures val_conv;
36124 val_conv.inner = (void*)(val & (~1));
36125 val_conv.is_owned = (val & 1) || (val == 0);
36126 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36127 val_conv = ChannelFeatures_clone(&val_conv);
36128 ChannelInfo_set_features(&this_ptr_conv, val_conv);
36131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
36132 LDKChannelInfo this_ptr_conv;
36133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36134 this_ptr_conv.is_owned = false;
36135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36136 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
36137 uint64_t ret_ref = 0;
36138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36141 ret_ref = (uint64_t)ret_var.inner;
36142 if (ret_var.is_owned) {
36148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36149 LDKChannelInfo this_ptr_conv;
36150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36151 this_ptr_conv.is_owned = false;
36152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36153 LDKNodeId val_conv;
36154 val_conv.inner = (void*)(val & (~1));
36155 val_conv.is_owned = (val & 1) || (val == 0);
36156 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36157 val_conv = NodeId_clone(&val_conv);
36158 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
36161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
36162 LDKChannelInfo this_ptr_conv;
36163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36164 this_ptr_conv.is_owned = false;
36165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36166 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
36167 uint64_t ret_ref = 0;
36168 if ((uint64_t)ret_var.inner > 4096) {
36169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36172 ret_ref = (uint64_t)ret_var.inner;
36173 if (ret_var.is_owned) {
36180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36181 LDKChannelInfo this_ptr_conv;
36182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36183 this_ptr_conv.is_owned = false;
36184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36185 LDKDirectionalChannelInfo val_conv;
36186 val_conv.inner = (void*)(val & (~1));
36187 val_conv.is_owned = (val & 1) || (val == 0);
36188 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36189 val_conv = DirectionalChannelInfo_clone(&val_conv);
36190 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
36193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
36194 LDKChannelInfo this_ptr_conv;
36195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36196 this_ptr_conv.is_owned = false;
36197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36198 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
36199 uint64_t ret_ref = 0;
36200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36203 ret_ref = (uint64_t)ret_var.inner;
36204 if (ret_var.is_owned) {
36210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36211 LDKChannelInfo this_ptr_conv;
36212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36213 this_ptr_conv.is_owned = false;
36214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36215 LDKNodeId val_conv;
36216 val_conv.inner = (void*)(val & (~1));
36217 val_conv.is_owned = (val & 1) || (val == 0);
36218 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36219 val_conv = NodeId_clone(&val_conv);
36220 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
36223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
36224 LDKChannelInfo this_ptr_conv;
36225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36226 this_ptr_conv.is_owned = false;
36227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36228 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
36229 uint64_t ret_ref = 0;
36230 if ((uint64_t)ret_var.inner > 4096) {
36231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36234 ret_ref = (uint64_t)ret_var.inner;
36235 if (ret_var.is_owned) {
36242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36243 LDKChannelInfo this_ptr_conv;
36244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36245 this_ptr_conv.is_owned = false;
36246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36247 LDKDirectionalChannelInfo val_conv;
36248 val_conv.inner = (void*)(val & (~1));
36249 val_conv.is_owned = (val & 1) || (val == 0);
36250 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36251 val_conv = DirectionalChannelInfo_clone(&val_conv);
36252 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
36255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
36256 LDKChannelInfo this_ptr_conv;
36257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36258 this_ptr_conv.is_owned = false;
36259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36260 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36261 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
36262 uint64_t ret_ref = (uint64_t)ret_copy;
36266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36267 LDKChannelInfo this_ptr_conv;
36268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36269 this_ptr_conv.is_owned = false;
36270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36271 void* val_ptr = (void*)(((uint64_t)val) & ~1);
36272 CHECK_ACCESS(val_ptr);
36273 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36274 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
36275 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
36278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
36279 LDKChannelInfo this_ptr_conv;
36280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36281 this_ptr_conv.is_owned = false;
36282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36283 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
36284 uint64_t ret_ref = 0;
36285 if ((uint64_t)ret_var.inner > 4096) {
36286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36289 ret_ref = (uint64_t)ret_var.inner;
36290 if (ret_var.is_owned) {
36297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36298 LDKChannelInfo this_ptr_conv;
36299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36300 this_ptr_conv.is_owned = false;
36301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36302 LDKChannelAnnouncement val_conv;
36303 val_conv.inner = (void*)(val & (~1));
36304 val_conv.is_owned = (val & 1) || (val == 0);
36305 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36306 val_conv = ChannelAnnouncement_clone(&val_conv);
36307 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
36310 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
36311 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
36312 uint64_t ret_ref = 0;
36313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36316 ret_ref = (uint64_t)ret_var.inner;
36317 if (ret_var.is_owned) {
36322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36323 LDKChannelInfo arg_conv;
36324 arg_conv.inner = (void*)(arg & (~1));
36325 arg_conv.is_owned = false;
36326 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36327 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
36331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36332 LDKChannelInfo orig_conv;
36333 orig_conv.inner = (void*)(orig & (~1));
36334 orig_conv.is_owned = false;
36335 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36336 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
36337 uint64_t ret_ref = 0;
36338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36341 ret_ref = (uint64_t)ret_var.inner;
36342 if (ret_var.is_owned) {
36348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
36349 LDKChannelInfo obj_conv;
36350 obj_conv.inner = (void*)(obj & (~1));
36351 obj_conv.is_owned = false;
36352 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36353 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
36354 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36355 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36356 CVec_u8Z_free(ret_var);
36360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36361 LDKu8slice ser_ref;
36362 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36363 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36364 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
36365 *ret_conv = ChannelInfo_read(ser_ref);
36366 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36367 return (uint64_t)ret_conv;
36370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36371 LDKRoutingFees this_obj_conv;
36372 this_obj_conv.inner = (void*)(this_obj & (~1));
36373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36375 RoutingFees_free(this_obj_conv);
36378 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36379 LDKRoutingFees this_ptr_conv;
36380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36381 this_ptr_conv.is_owned = false;
36382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36383 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
36387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36388 LDKRoutingFees this_ptr_conv;
36389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36390 this_ptr_conv.is_owned = false;
36391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36392 RoutingFees_set_base_msat(&this_ptr_conv, val);
36395 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36396 LDKRoutingFees this_ptr_conv;
36397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36398 this_ptr_conv.is_owned = false;
36399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36400 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
36404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36405 LDKRoutingFees this_ptr_conv;
36406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36407 this_ptr_conv.is_owned = false;
36408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36409 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
36412 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) {
36413 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
36414 uint64_t ret_ref = 0;
36415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36417 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36418 ret_ref = (uint64_t)ret_var.inner;
36419 if (ret_var.is_owned) {
36425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36426 LDKRoutingFees a_conv;
36427 a_conv.inner = (void*)(a & (~1));
36428 a_conv.is_owned = false;
36429 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36430 LDKRoutingFees b_conv;
36431 b_conv.inner = (void*)(b & (~1));
36432 b_conv.is_owned = false;
36433 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36434 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
36438 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
36439 LDKRoutingFees ret_var = RoutingFees_clone(arg);
36440 uint64_t ret_ref = 0;
36441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36444 ret_ref = (uint64_t)ret_var.inner;
36445 if (ret_var.is_owned) {
36450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36451 LDKRoutingFees arg_conv;
36452 arg_conv.inner = (void*)(arg & (~1));
36453 arg_conv.is_owned = false;
36454 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36455 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
36459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36460 LDKRoutingFees orig_conv;
36461 orig_conv.inner = (void*)(orig & (~1));
36462 orig_conv.is_owned = false;
36463 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36464 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
36465 uint64_t ret_ref = 0;
36466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36469 ret_ref = (uint64_t)ret_var.inner;
36470 if (ret_var.is_owned) {
36476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
36477 LDKRoutingFees o_conv;
36478 o_conv.inner = (void*)(o & (~1));
36479 o_conv.is_owned = false;
36480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36481 int64_t ret_val = RoutingFees_hash(&o_conv);
36485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
36486 LDKRoutingFees obj_conv;
36487 obj_conv.inner = (void*)(obj & (~1));
36488 obj_conv.is_owned = false;
36489 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36490 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
36491 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36492 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36493 CVec_u8Z_free(ret_var);
36497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36498 LDKu8slice ser_ref;
36499 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36500 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36501 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
36502 *ret_conv = RoutingFees_read(ser_ref);
36503 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36504 return (uint64_t)ret_conv;
36507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36508 LDKNodeAnnouncementInfo this_obj_conv;
36509 this_obj_conv.inner = (void*)(this_obj & (~1));
36510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36512 NodeAnnouncementInfo_free(this_obj_conv);
36515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
36516 LDKNodeAnnouncementInfo this_ptr_conv;
36517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36518 this_ptr_conv.is_owned = false;
36519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36520 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
36521 uint64_t ret_ref = 0;
36522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36525 ret_ref = (uint64_t)ret_var.inner;
36526 if (ret_var.is_owned) {
36532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36533 LDKNodeAnnouncementInfo this_ptr_conv;
36534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36535 this_ptr_conv.is_owned = false;
36536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36537 LDKNodeFeatures val_conv;
36538 val_conv.inner = (void*)(val & (~1));
36539 val_conv.is_owned = (val & 1) || (val == 0);
36540 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36541 val_conv = NodeFeatures_clone(&val_conv);
36542 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
36545 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
36546 LDKNodeAnnouncementInfo this_ptr_conv;
36547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36548 this_ptr_conv.is_owned = false;
36549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36550 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
36554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36555 LDKNodeAnnouncementInfo this_ptr_conv;
36556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36557 this_ptr_conv.is_owned = false;
36558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36559 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
36562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
36563 LDKNodeAnnouncementInfo this_ptr_conv;
36564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36565 this_ptr_conv.is_owned = false;
36566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36567 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
36568 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
36572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36573 LDKNodeAnnouncementInfo this_ptr_conv;
36574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36575 this_ptr_conv.is_owned = false;
36576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36577 LDKThreeBytes val_ref;
36578 CHECK((*env)->GetArrayLength(env, val) == 3);
36579 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
36580 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
36583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
36584 LDKNodeAnnouncementInfo this_ptr_conv;
36585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36586 this_ptr_conv.is_owned = false;
36587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36588 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
36593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36594 LDKNodeAnnouncementInfo this_ptr_conv;
36595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36596 this_ptr_conv.is_owned = false;
36597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36598 LDKThirtyTwoBytes val_ref;
36599 CHECK((*env)->GetArrayLength(env, val) == 32);
36600 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36601 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
36604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36605 LDKNodeAnnouncementInfo this_ptr_conv;
36606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36607 this_ptr_conv.is_owned = false;
36608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36609 LDKCVec_NetAddressZ val_constr;
36610 val_constr.datalen = (*env)->GetArrayLength(env, val);
36611 if (val_constr.datalen > 0)
36612 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36614 val_constr.data = NULL;
36615 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36616 for (size_t m = 0; m < val_constr.datalen; m++) {
36617 int64_t val_conv_12 = val_vals[m];
36618 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
36619 CHECK_ACCESS(val_conv_12_ptr);
36620 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
36621 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
36622 val_constr.data[m] = val_conv_12_conv;
36624 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36625 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
36628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
36629 LDKNodeAnnouncementInfo this_ptr_conv;
36630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36631 this_ptr_conv.is_owned = false;
36632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36633 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
36634 uint64_t ret_ref = 0;
36635 if ((uint64_t)ret_var.inner > 4096) {
36636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36639 ret_ref = (uint64_t)ret_var.inner;
36640 if (ret_var.is_owned) {
36647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36648 LDKNodeAnnouncementInfo this_ptr_conv;
36649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36650 this_ptr_conv.is_owned = false;
36651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36652 LDKNodeAnnouncement val_conv;
36653 val_conv.inner = (void*)(val & (~1));
36654 val_conv.is_owned = (val & 1) || (val == 0);
36655 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36656 val_conv = NodeAnnouncement_clone(&val_conv);
36657 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
36660 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) {
36661 LDKNodeFeatures features_arg_conv;
36662 features_arg_conv.inner = (void*)(features_arg & (~1));
36663 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
36664 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36665 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
36666 LDKThreeBytes rgb_arg_ref;
36667 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
36668 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
36669 LDKThirtyTwoBytes alias_arg_ref;
36670 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
36671 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
36672 LDKCVec_NetAddressZ addresses_arg_constr;
36673 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
36674 if (addresses_arg_constr.datalen > 0)
36675 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36677 addresses_arg_constr.data = NULL;
36678 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
36679 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
36680 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
36681 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
36682 CHECK_ACCESS(addresses_arg_conv_12_ptr);
36683 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
36684 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
36686 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
36687 LDKNodeAnnouncement announcement_message_arg_conv;
36688 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
36689 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
36690 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
36691 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
36692 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
36693 uint64_t ret_ref = 0;
36694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36697 ret_ref = (uint64_t)ret_var.inner;
36698 if (ret_var.is_owned) {
36704 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
36705 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
36706 uint64_t ret_ref = 0;
36707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36710 ret_ref = (uint64_t)ret_var.inner;
36711 if (ret_var.is_owned) {
36716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36717 LDKNodeAnnouncementInfo arg_conv;
36718 arg_conv.inner = (void*)(arg & (~1));
36719 arg_conv.is_owned = false;
36720 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36721 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
36725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36726 LDKNodeAnnouncementInfo orig_conv;
36727 orig_conv.inner = (void*)(orig & (~1));
36728 orig_conv.is_owned = false;
36729 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36730 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
36731 uint64_t ret_ref = 0;
36732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36735 ret_ref = (uint64_t)ret_var.inner;
36736 if (ret_var.is_owned) {
36742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
36743 LDKNodeAnnouncementInfo obj_conv;
36744 obj_conv.inner = (void*)(obj & (~1));
36745 obj_conv.is_owned = false;
36746 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36747 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
36748 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36749 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36750 CVec_u8Z_free(ret_var);
36754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36755 LDKu8slice ser_ref;
36756 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36757 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36758 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
36759 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
36760 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36761 return (uint64_t)ret_conv;
36764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36765 LDKNodeInfo this_obj_conv;
36766 this_obj_conv.inner = (void*)(this_obj & (~1));
36767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36769 NodeInfo_free(this_obj_conv);
36772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36773 LDKNodeInfo this_ptr_conv;
36774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36775 this_ptr_conv.is_owned = false;
36776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36777 LDKCVec_u64Z val_constr;
36778 val_constr.datalen = (*env)->GetArrayLength(env, val);
36779 if (val_constr.datalen > 0)
36780 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36782 val_constr.data = NULL;
36783 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36784 for (size_t g = 0; g < val_constr.datalen; g++) {
36785 int64_t val_conv_6 = val_vals[g];
36786 val_constr.data[g] = val_conv_6;
36788 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36789 NodeInfo_set_channels(&this_ptr_conv, val_constr);
36792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
36793 LDKNodeInfo this_ptr_conv;
36794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36795 this_ptr_conv.is_owned = false;
36796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36797 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
36798 uint64_t ret_ref = 0;
36799 if ((uint64_t)ret_var.inner > 4096) {
36800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36803 ret_ref = (uint64_t)ret_var.inner;
36804 if (ret_var.is_owned) {
36811 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) {
36812 LDKNodeInfo this_ptr_conv;
36813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36814 this_ptr_conv.is_owned = false;
36815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36816 LDKRoutingFees val_conv;
36817 val_conv.inner = (void*)(val & (~1));
36818 val_conv.is_owned = (val & 1) || (val == 0);
36819 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36820 val_conv = RoutingFees_clone(&val_conv);
36821 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
36824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
36825 LDKNodeInfo this_ptr_conv;
36826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36827 this_ptr_conv.is_owned = false;
36828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36829 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
36830 uint64_t ret_ref = 0;
36831 if ((uint64_t)ret_var.inner > 4096) {
36832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36835 ret_ref = (uint64_t)ret_var.inner;
36836 if (ret_var.is_owned) {
36843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36844 LDKNodeInfo this_ptr_conv;
36845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36846 this_ptr_conv.is_owned = false;
36847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36848 LDKNodeAnnouncementInfo val_conv;
36849 val_conv.inner = (void*)(val & (~1));
36850 val_conv.is_owned = (val & 1) || (val == 0);
36851 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36852 val_conv = NodeAnnouncementInfo_clone(&val_conv);
36853 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
36856 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) {
36857 LDKCVec_u64Z channels_arg_constr;
36858 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
36859 if (channels_arg_constr.datalen > 0)
36860 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36862 channels_arg_constr.data = NULL;
36863 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
36864 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
36865 int64_t channels_arg_conv_6 = channels_arg_vals[g];
36866 channels_arg_constr.data[g] = channels_arg_conv_6;
36868 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
36869 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
36870 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
36871 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
36872 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
36873 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
36874 LDKNodeAnnouncementInfo announcement_info_arg_conv;
36875 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
36876 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
36877 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
36878 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
36879 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
36880 uint64_t ret_ref = 0;
36881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36884 ret_ref = (uint64_t)ret_var.inner;
36885 if (ret_var.is_owned) {
36891 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
36892 LDKNodeInfo ret_var = NodeInfo_clone(arg);
36893 uint64_t ret_ref = 0;
36894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36897 ret_ref = (uint64_t)ret_var.inner;
36898 if (ret_var.is_owned) {
36903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36904 LDKNodeInfo arg_conv;
36905 arg_conv.inner = (void*)(arg & (~1));
36906 arg_conv.is_owned = false;
36907 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36908 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
36912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36913 LDKNodeInfo orig_conv;
36914 orig_conv.inner = (void*)(orig & (~1));
36915 orig_conv.is_owned = false;
36916 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36917 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
36918 uint64_t ret_ref = 0;
36919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36922 ret_ref = (uint64_t)ret_var.inner;
36923 if (ret_var.is_owned) {
36929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
36930 LDKNodeInfo obj_conv;
36931 obj_conv.inner = (void*)(obj & (~1));
36932 obj_conv.is_owned = false;
36933 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36934 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
36935 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36936 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36937 CVec_u8Z_free(ret_var);
36941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36942 LDKu8slice ser_ref;
36943 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36944 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36945 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
36946 *ret_conv = NodeInfo_read(ser_ref);
36947 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36948 return (uint64_t)ret_conv;
36951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
36952 LDKNetworkGraph obj_conv;
36953 obj_conv.inner = (void*)(obj & (~1));
36954 obj_conv.is_owned = false;
36955 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36956 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
36957 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36958 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36959 CVec_u8Z_free(ret_var);
36963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36964 LDKu8slice ser_ref;
36965 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36966 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36967 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
36968 *ret_conv = NetworkGraph_read(ser_ref);
36969 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36970 return (uint64_t)ret_conv;
36973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
36974 LDKThirtyTwoBytes genesis_hash_ref;
36975 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
36976 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
36977 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
36978 uint64_t ret_ref = 0;
36979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36982 ret_ref = (uint64_t)ret_var.inner;
36983 if (ret_var.is_owned) {
36989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
36990 LDKNetworkGraph this_arg_conv;
36991 this_arg_conv.inner = (void*)(this_arg & (~1));
36992 this_arg_conv.is_owned = false;
36993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36994 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
36995 uint64_t ret_ref = 0;
36996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36999 ret_ref = (uint64_t)ret_var.inner;
37000 if (ret_var.is_owned) {
37006 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) {
37007 LDKNetworkGraph this_arg_conv;
37008 this_arg_conv.inner = (void*)(this_arg & (~1));
37009 this_arg_conv.is_owned = false;
37010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37011 LDKNodeAnnouncement msg_conv;
37012 msg_conv.inner = (void*)(msg & (~1));
37013 msg_conv.is_owned = false;
37014 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37015 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37016 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
37017 return (uint64_t)ret_conv;
37020 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) {
37021 LDKNetworkGraph this_arg_conv;
37022 this_arg_conv.inner = (void*)(this_arg & (~1));
37023 this_arg_conv.is_owned = false;
37024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37025 LDKUnsignedNodeAnnouncement msg_conv;
37026 msg_conv.inner = (void*)(msg & (~1));
37027 msg_conv.is_owned = false;
37028 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37029 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37030 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
37031 return (uint64_t)ret_conv;
37034 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) {
37035 LDKNetworkGraph this_arg_conv;
37036 this_arg_conv.inner = (void*)(this_arg & (~1));
37037 this_arg_conv.is_owned = false;
37038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37039 LDKChannelAnnouncement msg_conv;
37040 msg_conv.inner = (void*)(msg & (~1));
37041 msg_conv.is_owned = false;
37042 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37043 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
37044 CHECK_ACCESS(chain_access_ptr);
37045 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37046 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
37047 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37048 // Manually implement clone for Java trait instances
37049 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37050 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37051 LDKAccess_JCalls_cloned(&chain_access_conv.some);
37054 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37055 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
37056 return (uint64_t)ret_conv;
37059 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) {
37060 LDKNetworkGraph this_arg_conv;
37061 this_arg_conv.inner = (void*)(this_arg & (~1));
37062 this_arg_conv.is_owned = false;
37063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37064 LDKUnsignedChannelAnnouncement msg_conv;
37065 msg_conv.inner = (void*)(msg & (~1));
37066 msg_conv.is_owned = false;
37067 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37068 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
37069 CHECK_ACCESS(chain_access_ptr);
37070 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37071 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
37072 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37073 // Manually implement clone for Java trait instances
37074 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37075 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37076 LDKAccess_JCalls_cloned(&chain_access_conv.some);
37079 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37080 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
37081 return (uint64_t)ret_conv;
37084 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) {
37085 LDKNetworkGraph this_arg_conv;
37086 this_arg_conv.inner = (void*)(this_arg & (~1));
37087 this_arg_conv.is_owned = false;
37088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37089 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
37092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
37093 LDKNetworkGraph this_arg_conv;
37094 this_arg_conv.inner = (void*)(this_arg & (~1));
37095 this_arg_conv.is_owned = false;
37096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37097 LDKPublicKey _node_id_ref;
37098 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
37099 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
37100 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
37103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
37104 LDKNetworkGraph this_arg_conv;
37105 this_arg_conv.inner = (void*)(this_arg & (~1));
37106 this_arg_conv.is_owned = false;
37107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37108 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
37111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
37112 LDKNetworkGraph this_arg_conv;
37113 this_arg_conv.inner = (void*)(this_arg & (~1));
37114 this_arg_conv.is_owned = false;
37115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37116 LDKChannelUpdate msg_conv;
37117 msg_conv.inner = (void*)(msg & (~1));
37118 msg_conv.is_owned = false;
37119 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37120 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37121 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
37122 return (uint64_t)ret_conv;
37125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
37126 LDKNetworkGraph this_arg_conv;
37127 this_arg_conv.inner = (void*)(this_arg & (~1));
37128 this_arg_conv.is_owned = false;
37129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37130 LDKUnsignedChannelUpdate msg_conv;
37131 msg_conv.inner = (void*)(msg & (~1));
37132 msg_conv.is_owned = false;
37133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37134 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37135 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
37136 return (uint64_t)ret_conv;
37139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
37140 LDKReadOnlyNetworkGraph this_arg_conv;
37141 this_arg_conv.inner = (void*)(this_arg & (~1));
37142 this_arg_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37144 LDKPublicKey pubkey_ref;
37145 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
37146 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
37147 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
37148 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
37149 uint64_t ret_ref = (uint64_t)ret_copy;
37153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37154 LDKRouteHop this_obj_conv;
37155 this_obj_conv.inner = (void*)(this_obj & (~1));
37156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37158 RouteHop_free(this_obj_conv);
37161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37162 LDKRouteHop this_ptr_conv;
37163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37164 this_ptr_conv.is_owned = false;
37165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37166 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37167 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
37171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37172 LDKRouteHop this_ptr_conv;
37173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37174 this_ptr_conv.is_owned = false;
37175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37176 LDKPublicKey val_ref;
37177 CHECK((*env)->GetArrayLength(env, val) == 33);
37178 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37179 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
37182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
37183 LDKRouteHop this_ptr_conv;
37184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37185 this_ptr_conv.is_owned = false;
37186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37187 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
37188 uint64_t ret_ref = 0;
37189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37192 ret_ref = (uint64_t)ret_var.inner;
37193 if (ret_var.is_owned) {
37199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37200 LDKRouteHop this_ptr_conv;
37201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37202 this_ptr_conv.is_owned = false;
37203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37204 LDKNodeFeatures val_conv;
37205 val_conv.inner = (void*)(val & (~1));
37206 val_conv.is_owned = (val & 1) || (val == 0);
37207 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37208 val_conv = NodeFeatures_clone(&val_conv);
37209 RouteHop_set_node_features(&this_ptr_conv, val_conv);
37212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37213 LDKRouteHop this_ptr_conv;
37214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37215 this_ptr_conv.is_owned = false;
37216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37217 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
37221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37222 LDKRouteHop this_ptr_conv;
37223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37224 this_ptr_conv.is_owned = false;
37225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37226 RouteHop_set_short_channel_id(&this_ptr_conv, val);
37229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
37230 LDKRouteHop this_ptr_conv;
37231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37232 this_ptr_conv.is_owned = false;
37233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37234 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
37235 uint64_t ret_ref = 0;
37236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37239 ret_ref = (uint64_t)ret_var.inner;
37240 if (ret_var.is_owned) {
37246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37247 LDKRouteHop this_ptr_conv;
37248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37249 this_ptr_conv.is_owned = false;
37250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37251 LDKChannelFeatures val_conv;
37252 val_conv.inner = (void*)(val & (~1));
37253 val_conv.is_owned = (val & 1) || (val == 0);
37254 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37255 val_conv = ChannelFeatures_clone(&val_conv);
37256 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
37259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37260 LDKRouteHop this_ptr_conv;
37261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37262 this_ptr_conv.is_owned = false;
37263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37264 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
37268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37269 LDKRouteHop this_ptr_conv;
37270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37271 this_ptr_conv.is_owned = false;
37272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37273 RouteHop_set_fee_msat(&this_ptr_conv, val);
37276 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
37277 LDKRouteHop this_ptr_conv;
37278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37279 this_ptr_conv.is_owned = false;
37280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37281 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
37285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37286 LDKRouteHop this_ptr_conv;
37287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37288 this_ptr_conv.is_owned = false;
37289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37290 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
37293 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) {
37294 LDKPublicKey pubkey_arg_ref;
37295 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
37296 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
37297 LDKNodeFeatures node_features_arg_conv;
37298 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
37299 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
37300 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
37301 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
37302 LDKChannelFeatures channel_features_arg_conv;
37303 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
37304 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
37305 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
37306 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
37307 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);
37308 uint64_t ret_ref = 0;
37309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37312 ret_ref = (uint64_t)ret_var.inner;
37313 if (ret_var.is_owned) {
37319 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
37320 LDKRouteHop ret_var = RouteHop_clone(arg);
37321 uint64_t ret_ref = 0;
37322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37325 ret_ref = (uint64_t)ret_var.inner;
37326 if (ret_var.is_owned) {
37331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37332 LDKRouteHop arg_conv;
37333 arg_conv.inner = (void*)(arg & (~1));
37334 arg_conv.is_owned = false;
37335 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37336 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
37340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37341 LDKRouteHop orig_conv;
37342 orig_conv.inner = (void*)(orig & (~1));
37343 orig_conv.is_owned = false;
37344 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37345 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
37346 uint64_t ret_ref = 0;
37347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37350 ret_ref = (uint64_t)ret_var.inner;
37351 if (ret_var.is_owned) {
37357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
37358 LDKRouteHop o_conv;
37359 o_conv.inner = (void*)(o & (~1));
37360 o_conv.is_owned = false;
37361 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37362 int64_t ret_val = RouteHop_hash(&o_conv);
37366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37367 LDKRouteHop a_conv;
37368 a_conv.inner = (void*)(a & (~1));
37369 a_conv.is_owned = false;
37370 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37371 LDKRouteHop b_conv;
37372 b_conv.inner = (void*)(b & (~1));
37373 b_conv.is_owned = false;
37374 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37375 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
37379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
37380 LDKRouteHop obj_conv;
37381 obj_conv.inner = (void*)(obj & (~1));
37382 obj_conv.is_owned = false;
37383 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37384 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
37385 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37386 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37387 CVec_u8Z_free(ret_var);
37391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37392 LDKu8slice ser_ref;
37393 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37394 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37395 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
37396 *ret_conv = RouteHop_read(ser_ref);
37397 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37398 return (uint64_t)ret_conv;
37401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37402 LDKRoute this_obj_conv;
37403 this_obj_conv.inner = (void*)(this_obj & (~1));
37404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37406 Route_free(this_obj_conv);
37409 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
37410 LDKRoute this_ptr_conv;
37411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37412 this_ptr_conv.is_owned = false;
37413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37414 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
37415 jobjectArray ret_arr = NULL;
37416 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
37418 for (size_t m = 0; m < ret_var.datalen; m++) {
37419 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
37420 int64_tArray ret_conv_12_arr = NULL;
37421 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
37422 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
37423 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
37424 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
37425 uint64_t ret_conv_12_conv_10_ref = 0;
37426 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37427 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
37429 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
37430 if (ret_conv_12_conv_10_var.is_owned) {
37431 ret_conv_12_conv_10_ref |= 1;
37433 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
37435 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
37436 FREE(ret_conv_12_var.data);
37437 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
37440 FREE(ret_var.data);
37444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
37445 LDKRoute this_ptr_conv;
37446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37447 this_ptr_conv.is_owned = false;
37448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37449 LDKCVec_CVec_RouteHopZZ val_constr;
37450 val_constr.datalen = (*env)->GetArrayLength(env, val);
37451 if (val_constr.datalen > 0)
37452 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37454 val_constr.data = NULL;
37455 for (size_t m = 0; m < val_constr.datalen; m++) {
37456 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
37457 LDKCVec_RouteHopZ val_conv_12_constr;
37458 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
37459 if (val_conv_12_constr.datalen > 0)
37460 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37462 val_conv_12_constr.data = NULL;
37463 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
37464 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
37465 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
37466 LDKRouteHop val_conv_12_conv_10_conv;
37467 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
37468 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
37469 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
37470 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
37471 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
37473 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
37474 val_constr.data[m] = val_conv_12_constr;
37476 Route_set_paths(&this_ptr_conv, val_constr);
37479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
37480 LDKRoute this_ptr_conv;
37481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37482 this_ptr_conv.is_owned = false;
37483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
37485 uint64_t ret_ref = 0;
37486 if ((uint64_t)ret_var.inner > 4096) {
37487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37490 ret_ref = (uint64_t)ret_var.inner;
37491 if (ret_var.is_owned) {
37498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37499 LDKRoute this_ptr_conv;
37500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37501 this_ptr_conv.is_owned = false;
37502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37504 val_conv.inner = (void*)(val & (~1));
37505 val_conv.is_owned = (val & 1) || (val == 0);
37506 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37507 val_conv = Payee_clone(&val_conv);
37508 Route_set_payee(&this_ptr_conv, val_conv);
37511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) {
37512 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
37513 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
37514 if (paths_arg_constr.datalen > 0)
37515 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37517 paths_arg_constr.data = NULL;
37518 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
37519 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
37520 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
37521 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
37522 if (paths_arg_conv_12_constr.datalen > 0)
37523 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37525 paths_arg_conv_12_constr.data = NULL;
37526 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
37527 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
37528 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
37529 LDKRouteHop paths_arg_conv_12_conv_10_conv;
37530 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
37531 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
37532 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
37533 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
37534 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
37536 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
37537 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
37539 LDKPayee payee_arg_conv;
37540 payee_arg_conv.inner = (void*)(payee_arg & (~1));
37541 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
37542 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
37543 payee_arg_conv = Payee_clone(&payee_arg_conv);
37544 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
37545 uint64_t ret_ref = 0;
37546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37549 ret_ref = (uint64_t)ret_var.inner;
37550 if (ret_var.is_owned) {
37556 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
37557 LDKRoute ret_var = Route_clone(arg);
37558 uint64_t ret_ref = 0;
37559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37562 ret_ref = (uint64_t)ret_var.inner;
37563 if (ret_var.is_owned) {
37568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37570 arg_conv.inner = (void*)(arg & (~1));
37571 arg_conv.is_owned = false;
37572 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37573 int64_t ret_val = Route_clone_ptr(&arg_conv);
37577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37578 LDKRoute orig_conv;
37579 orig_conv.inner = (void*)(orig & (~1));
37580 orig_conv.is_owned = false;
37581 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37582 LDKRoute ret_var = Route_clone(&orig_conv);
37583 uint64_t ret_ref = 0;
37584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37587 ret_ref = (uint64_t)ret_var.inner;
37588 if (ret_var.is_owned) {
37594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
37596 o_conv.inner = (void*)(o & (~1));
37597 o_conv.is_owned = false;
37598 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37599 int64_t ret_val = Route_hash(&o_conv);
37603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37605 a_conv.inner = (void*)(a & (~1));
37606 a_conv.is_owned = false;
37607 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37609 b_conv.inner = (void*)(b & (~1));
37610 b_conv.is_owned = false;
37611 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37612 jboolean ret_val = Route_eq(&a_conv, &b_conv);
37616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
37617 LDKRoute this_arg_conv;
37618 this_arg_conv.inner = (void*)(this_arg & (~1));
37619 this_arg_conv.is_owned = false;
37620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37621 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
37625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
37626 LDKRoute this_arg_conv;
37627 this_arg_conv.inner = (void*)(this_arg & (~1));
37628 this_arg_conv.is_owned = false;
37629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37630 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
37634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
37636 obj_conv.inner = (void*)(obj & (~1));
37637 obj_conv.is_owned = false;
37638 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37639 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
37640 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37641 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37642 CVec_u8Z_free(ret_var);
37646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37647 LDKu8slice ser_ref;
37648 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37649 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37650 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
37651 *ret_conv = Route_read(ser_ref);
37652 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37653 return (uint64_t)ret_conv;
37656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37657 LDKRouteParameters this_obj_conv;
37658 this_obj_conv.inner = (void*)(this_obj & (~1));
37659 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37661 RouteParameters_free(this_obj_conv);
37664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
37665 LDKRouteParameters this_ptr_conv;
37666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37667 this_ptr_conv.is_owned = false;
37668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37669 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
37670 uint64_t ret_ref = 0;
37671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37674 ret_ref = (uint64_t)ret_var.inner;
37675 if (ret_var.is_owned) {
37681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37682 LDKRouteParameters this_ptr_conv;
37683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37684 this_ptr_conv.is_owned = false;
37685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37687 val_conv.inner = (void*)(val & (~1));
37688 val_conv.is_owned = (val & 1) || (val == 0);
37689 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37690 val_conv = Payee_clone(&val_conv);
37691 RouteParameters_set_payee(&this_ptr_conv, val_conv);
37694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37695 LDKRouteParameters this_ptr_conv;
37696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37697 this_ptr_conv.is_owned = false;
37698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37699 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
37703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37704 LDKRouteParameters this_ptr_conv;
37705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37706 this_ptr_conv.is_owned = false;
37707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37708 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
37711 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
37712 LDKRouteParameters this_ptr_conv;
37713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37714 this_ptr_conv.is_owned = false;
37715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37716 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
37720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37721 LDKRouteParameters this_ptr_conv;
37722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37723 this_ptr_conv.is_owned = false;
37724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37725 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
37728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
37729 LDKPayee payee_arg_conv;
37730 payee_arg_conv.inner = (void*)(payee_arg & (~1));
37731 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
37732 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
37733 payee_arg_conv = Payee_clone(&payee_arg_conv);
37734 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
37735 uint64_t ret_ref = 0;
37736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37739 ret_ref = (uint64_t)ret_var.inner;
37740 if (ret_var.is_owned) {
37746 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
37747 LDKRouteParameters ret_var = RouteParameters_clone(arg);
37748 uint64_t ret_ref = 0;
37749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37752 ret_ref = (uint64_t)ret_var.inner;
37753 if (ret_var.is_owned) {
37758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37759 LDKRouteParameters arg_conv;
37760 arg_conv.inner = (void*)(arg & (~1));
37761 arg_conv.is_owned = false;
37762 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37763 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
37767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37768 LDKRouteParameters orig_conv;
37769 orig_conv.inner = (void*)(orig & (~1));
37770 orig_conv.is_owned = false;
37771 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37772 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
37773 uint64_t ret_ref = 0;
37774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37777 ret_ref = (uint64_t)ret_var.inner;
37778 if (ret_var.is_owned) {
37784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37785 LDKRouteParameters obj_conv;
37786 obj_conv.inner = (void*)(obj & (~1));
37787 obj_conv.is_owned = false;
37788 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37789 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
37790 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37791 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37792 CVec_u8Z_free(ret_var);
37796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37797 LDKu8slice ser_ref;
37798 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37799 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37800 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
37801 *ret_conv = RouteParameters_read(ser_ref);
37802 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37803 return (uint64_t)ret_conv;
37806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37807 LDKPayee this_obj_conv;
37808 this_obj_conv.inner = (void*)(this_obj & (~1));
37809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37811 Payee_free(this_obj_conv);
37814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37815 LDKPayee this_ptr_conv;
37816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37817 this_ptr_conv.is_owned = false;
37818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37819 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37820 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form);
37824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37825 LDKPayee this_ptr_conv;
37826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37827 this_ptr_conv.is_owned = false;
37828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37829 LDKPublicKey val_ref;
37830 CHECK((*env)->GetArrayLength(env, val) == 33);
37831 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37832 Payee_set_pubkey(&this_ptr_conv, val_ref);
37835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
37836 LDKPayee this_ptr_conv;
37837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37838 this_ptr_conv.is_owned = false;
37839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37840 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
37841 uint64_t ret_ref = 0;
37842 if ((uint64_t)ret_var.inner > 4096) {
37843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37846 ret_ref = (uint64_t)ret_var.inner;
37847 if (ret_var.is_owned) {
37854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37855 LDKPayee this_ptr_conv;
37856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37857 this_ptr_conv.is_owned = false;
37858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37859 LDKInvoiceFeatures val_conv;
37860 val_conv.inner = (void*)(val & (~1));
37861 val_conv.is_owned = (val & 1) || (val == 0);
37862 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37863 val_conv = InvoiceFeatures_clone(&val_conv);
37864 Payee_set_features(&this_ptr_conv, val_conv);
37867 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
37868 LDKPayee this_ptr_conv;
37869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37870 this_ptr_conv.is_owned = false;
37871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37872 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
37873 int64_tArray ret_arr = NULL;
37874 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37875 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37876 for (size_t l = 0; l < ret_var.datalen; l++) {
37877 LDKRouteHint ret_conv_11_var = ret_var.data[l];
37878 uint64_t ret_conv_11_ref = 0;
37879 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37880 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
37882 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
37883 if (ret_conv_11_var.is_owned) {
37884 ret_conv_11_ref |= 1;
37886 ret_arr_ptr[l] = ret_conv_11_ref;
37888 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37889 FREE(ret_var.data);
37893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37894 LDKPayee this_ptr_conv;
37895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37896 this_ptr_conv.is_owned = false;
37897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37898 LDKCVec_RouteHintZ val_constr;
37899 val_constr.datalen = (*env)->GetArrayLength(env, val);
37900 if (val_constr.datalen > 0)
37901 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37903 val_constr.data = NULL;
37904 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37905 for (size_t l = 0; l < val_constr.datalen; l++) {
37906 int64_t val_conv_11 = val_vals[l];
37907 LDKRouteHint val_conv_11_conv;
37908 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
37909 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
37910 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
37911 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
37912 val_constr.data[l] = val_conv_11_conv;
37914 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37915 Payee_set_route_hints(&this_ptr_conv, val_constr);
37918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
37919 LDKPayee this_ptr_conv;
37920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37921 this_ptr_conv.is_owned = false;
37922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37923 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37924 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
37925 uint64_t ret_ref = (uint64_t)ret_copy;
37929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37930 LDKPayee this_ptr_conv;
37931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37932 this_ptr_conv.is_owned = false;
37933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37934 void* val_ptr = (void*)(((uint64_t)val) & ~1);
37935 CHECK_ACCESS(val_ptr);
37936 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37937 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
37938 Payee_set_expiry_time(&this_ptr_conv, val_conv);
37941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) {
37942 LDKPublicKey pubkey_arg_ref;
37943 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
37944 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
37945 LDKInvoiceFeatures features_arg_conv;
37946 features_arg_conv.inner = (void*)(features_arg & (~1));
37947 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
37948 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
37949 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
37950 LDKCVec_RouteHintZ route_hints_arg_constr;
37951 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
37952 if (route_hints_arg_constr.datalen > 0)
37953 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37955 route_hints_arg_constr.data = NULL;
37956 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
37957 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
37958 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
37959 LDKRouteHint route_hints_arg_conv_11_conv;
37960 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
37961 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
37962 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
37963 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
37964 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
37966 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
37967 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
37968 CHECK_ACCESS(expiry_time_arg_ptr);
37969 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
37970 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
37971 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
37972 uint64_t ret_ref = 0;
37973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37976 ret_ref = (uint64_t)ret_var.inner;
37977 if (ret_var.is_owned) {
37983 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
37984 LDKPayee ret_var = Payee_clone(arg);
37985 uint64_t ret_ref = 0;
37986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37989 ret_ref = (uint64_t)ret_var.inner;
37990 if (ret_var.is_owned) {
37995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37997 arg_conv.inner = (void*)(arg & (~1));
37998 arg_conv.is_owned = false;
37999 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38000 int64_t ret_val = Payee_clone_ptr(&arg_conv);
38004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38005 LDKPayee orig_conv;
38006 orig_conv.inner = (void*)(orig & (~1));
38007 orig_conv.is_owned = false;
38008 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38009 LDKPayee ret_var = Payee_clone(&orig_conv);
38010 uint64_t ret_ref = 0;
38011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38014 ret_ref = (uint64_t)ret_var.inner;
38015 if (ret_var.is_owned) {
38021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
38023 o_conv.inner = (void*)(o & (~1));
38024 o_conv.is_owned = false;
38025 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38026 int64_t ret_val = Payee_hash(&o_conv);
38030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38032 a_conv.inner = (void*)(a & (~1));
38033 a_conv.is_owned = false;
38034 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38036 b_conv.inner = (void*)(b & (~1));
38037 b_conv.is_owned = false;
38038 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38039 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
38043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) {
38045 obj_conv.inner = (void*)(obj & (~1));
38046 obj_conv.is_owned = false;
38047 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38048 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
38049 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38050 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38051 CVec_u8Z_free(ret_var);
38055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38056 LDKu8slice ser_ref;
38057 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38058 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38059 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
38060 *ret_conv = Payee_read(ser_ref);
38061 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38062 return (uint64_t)ret_conv;
38065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) {
38066 LDKPublicKey pubkey_ref;
38067 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
38068 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
38069 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
38070 uint64_t ret_ref = 0;
38071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38074 ret_ref = (uint64_t)ret_var.inner;
38075 if (ret_var.is_owned) {
38081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) {
38082 LDKPublicKey pubkey_ref;
38083 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
38084 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
38085 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
38086 uint64_t ret_ref = 0;
38087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38090 ret_ref = (uint64_t)ret_var.inner;
38091 if (ret_var.is_owned) {
38097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38098 LDKRouteHint this_obj_conv;
38099 this_obj_conv.inner = (void*)(this_obj & (~1));
38100 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38102 RouteHint_free(this_obj_conv);
38105 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
38106 LDKRouteHint this_ptr_conv;
38107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38108 this_ptr_conv.is_owned = false;
38109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38110 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
38111 int64_tArray ret_arr = NULL;
38112 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38113 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38114 for (size_t o = 0; o < ret_var.datalen; o++) {
38115 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
38116 uint64_t ret_conv_14_ref = 0;
38117 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38118 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
38120 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
38121 if (ret_conv_14_var.is_owned) {
38122 ret_conv_14_ref |= 1;
38124 ret_arr_ptr[o] = ret_conv_14_ref;
38126 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38127 FREE(ret_var.data);
38131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
38132 LDKRouteHint this_ptr_conv;
38133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38134 this_ptr_conv.is_owned = false;
38135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38136 LDKCVec_RouteHintHopZ val_constr;
38137 val_constr.datalen = (*env)->GetArrayLength(env, val);
38138 if (val_constr.datalen > 0)
38139 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
38141 val_constr.data = NULL;
38142 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
38143 for (size_t o = 0; o < val_constr.datalen; o++) {
38144 int64_t val_conv_14 = val_vals[o];
38145 LDKRouteHintHop val_conv_14_conv;
38146 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
38147 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
38148 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
38149 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
38150 val_constr.data[o] = val_conv_14_conv;
38152 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
38153 RouteHint_set_a(&this_ptr_conv, val_constr);
38156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
38157 LDKCVec_RouteHintHopZ a_arg_constr;
38158 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
38159 if (a_arg_constr.datalen > 0)
38160 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
38162 a_arg_constr.data = NULL;
38163 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
38164 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
38165 int64_t a_arg_conv_14 = a_arg_vals[o];
38166 LDKRouteHintHop a_arg_conv_14_conv;
38167 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
38168 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
38169 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
38170 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
38171 a_arg_constr.data[o] = a_arg_conv_14_conv;
38173 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
38174 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
38175 uint64_t ret_ref = 0;
38176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38179 ret_ref = (uint64_t)ret_var.inner;
38180 if (ret_var.is_owned) {
38186 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
38187 LDKRouteHint ret_var = RouteHint_clone(arg);
38188 uint64_t ret_ref = 0;
38189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38192 ret_ref = (uint64_t)ret_var.inner;
38193 if (ret_var.is_owned) {
38198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38199 LDKRouteHint arg_conv;
38200 arg_conv.inner = (void*)(arg & (~1));
38201 arg_conv.is_owned = false;
38202 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38203 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
38207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38208 LDKRouteHint orig_conv;
38209 orig_conv.inner = (void*)(orig & (~1));
38210 orig_conv.is_owned = false;
38211 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38212 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
38213 uint64_t ret_ref = 0;
38214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38217 ret_ref = (uint64_t)ret_var.inner;
38218 if (ret_var.is_owned) {
38224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
38225 LDKRouteHint o_conv;
38226 o_conv.inner = (void*)(o & (~1));
38227 o_conv.is_owned = false;
38228 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38229 int64_t ret_val = RouteHint_hash(&o_conv);
38233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38234 LDKRouteHint a_conv;
38235 a_conv.inner = (void*)(a & (~1));
38236 a_conv.is_owned = false;
38237 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38238 LDKRouteHint b_conv;
38239 b_conv.inner = (void*)(b & (~1));
38240 b_conv.is_owned = false;
38241 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38242 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
38246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
38247 LDKRouteHint obj_conv;
38248 obj_conv.inner = (void*)(obj & (~1));
38249 obj_conv.is_owned = false;
38250 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38251 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
38252 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38253 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38254 CVec_u8Z_free(ret_var);
38258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38259 LDKu8slice ser_ref;
38260 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38261 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38262 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
38263 *ret_conv = RouteHint_read(ser_ref);
38264 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38265 return (uint64_t)ret_conv;
38268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38269 LDKRouteHintHop this_obj_conv;
38270 this_obj_conv.inner = (void*)(this_obj & (~1));
38271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38273 RouteHintHop_free(this_obj_conv);
38276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38277 LDKRouteHintHop this_ptr_conv;
38278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38279 this_ptr_conv.is_owned = false;
38280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38281 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
38286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38287 LDKRouteHintHop this_ptr_conv;
38288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38289 this_ptr_conv.is_owned = false;
38290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38291 LDKPublicKey val_ref;
38292 CHECK((*env)->GetArrayLength(env, val) == 33);
38293 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38294 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
38297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38298 LDKRouteHintHop this_ptr_conv;
38299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38300 this_ptr_conv.is_owned = false;
38301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38302 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
38306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38307 LDKRouteHintHop this_ptr_conv;
38308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38309 this_ptr_conv.is_owned = false;
38310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38311 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
38314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
38315 LDKRouteHintHop this_ptr_conv;
38316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38317 this_ptr_conv.is_owned = false;
38318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38319 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
38320 uint64_t ret_ref = 0;
38321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38324 ret_ref = (uint64_t)ret_var.inner;
38325 if (ret_var.is_owned) {
38331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38332 LDKRouteHintHop this_ptr_conv;
38333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38334 this_ptr_conv.is_owned = false;
38335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38336 LDKRoutingFees val_conv;
38337 val_conv.inner = (void*)(val & (~1));
38338 val_conv.is_owned = (val & 1) || (val == 0);
38339 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38340 val_conv = RoutingFees_clone(&val_conv);
38341 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
38344 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
38345 LDKRouteHintHop this_ptr_conv;
38346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38347 this_ptr_conv.is_owned = false;
38348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38349 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
38353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38354 LDKRouteHintHop this_ptr_conv;
38355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38356 this_ptr_conv.is_owned = false;
38357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38358 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
38361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38362 LDKRouteHintHop this_ptr_conv;
38363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38364 this_ptr_conv.is_owned = false;
38365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38366 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38367 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
38368 uint64_t ret_ref = (uint64_t)ret_copy;
38372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38373 LDKRouteHintHop this_ptr_conv;
38374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38375 this_ptr_conv.is_owned = false;
38376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38377 void* val_ptr = (void*)(((uint64_t)val) & ~1);
38378 CHECK_ACCESS(val_ptr);
38379 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38380 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
38381 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
38384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38385 LDKRouteHintHop this_ptr_conv;
38386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38387 this_ptr_conv.is_owned = false;
38388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38389 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38390 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
38391 uint64_t ret_ref = (uint64_t)ret_copy;
38395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38396 LDKRouteHintHop this_ptr_conv;
38397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38398 this_ptr_conv.is_owned = false;
38399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38400 void* val_ptr = (void*)(((uint64_t)val) & ~1);
38401 CHECK_ACCESS(val_ptr);
38402 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38403 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
38404 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38407 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) {
38408 LDKPublicKey src_node_id_arg_ref;
38409 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
38410 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
38411 LDKRoutingFees fees_arg_conv;
38412 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38413 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38414 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38415 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38416 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
38417 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
38418 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
38419 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
38420 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
38421 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38422 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38423 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
38424 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);
38425 uint64_t ret_ref = 0;
38426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38429 ret_ref = (uint64_t)ret_var.inner;
38430 if (ret_var.is_owned) {
38436 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
38437 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
38438 uint64_t ret_ref = 0;
38439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38442 ret_ref = (uint64_t)ret_var.inner;
38443 if (ret_var.is_owned) {
38448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38449 LDKRouteHintHop arg_conv;
38450 arg_conv.inner = (void*)(arg & (~1));
38451 arg_conv.is_owned = false;
38452 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38453 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
38457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38458 LDKRouteHintHop orig_conv;
38459 orig_conv.inner = (void*)(orig & (~1));
38460 orig_conv.is_owned = false;
38461 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38462 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
38463 uint64_t ret_ref = 0;
38464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38467 ret_ref = (uint64_t)ret_var.inner;
38468 if (ret_var.is_owned) {
38474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
38475 LDKRouteHintHop o_conv;
38476 o_conv.inner = (void*)(o & (~1));
38477 o_conv.is_owned = false;
38478 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38479 int64_t ret_val = RouteHintHop_hash(&o_conv);
38483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38484 LDKRouteHintHop a_conv;
38485 a_conv.inner = (void*)(a & (~1));
38486 a_conv.is_owned = false;
38487 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38488 LDKRouteHintHop b_conv;
38489 b_conv.inner = (void*)(b & (~1));
38490 b_conv.is_owned = false;
38491 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38492 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
38496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
38497 LDKRouteHintHop obj_conv;
38498 obj_conv.inner = (void*)(obj & (~1));
38499 obj_conv.is_owned = false;
38500 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38501 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
38502 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38503 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38504 CVec_u8Z_free(ret_var);
38508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38509 LDKu8slice ser_ref;
38510 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38511 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38512 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
38513 *ret_conv = RouteHintHop_read(ser_ref);
38514 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38515 return (uint64_t)ret_conv;
38518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) {
38519 LDKPublicKey our_node_pubkey_ref;
38520 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
38521 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
38522 LDKRouteParameters params_conv;
38523 params_conv.inner = (void*)(params & (~1));
38524 params_conv.is_owned = false;
38525 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38526 LDKNetworkGraph network_conv;
38527 network_conv.inner = (void*)(network & (~1));
38528 network_conv.is_owned = false;
38529 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
38530 LDKCVec_ChannelDetailsZ first_hops_constr;
38531 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
38532 if (first_hops != NULL) {
38533 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
38534 if (first_hops_constr.datalen > 0)
38535 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38537 first_hops_constr.data = NULL;
38538 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
38539 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
38540 int64_t first_hops_conv_16 = first_hops_vals[q];
38541 LDKChannelDetails first_hops_conv_16_conv;
38542 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
38543 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
38544 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
38545 first_hops_constr.data[q] = first_hops_conv_16_conv;
38547 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
38548 first_hops_ptr = &first_hops_constr;
38550 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
38551 CHECK_ACCESS(logger_ptr);
38552 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38553 if (logger_conv.free == LDKLogger_JCalls_free) {
38554 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38555 LDKLogger_JCalls_cloned(&logger_conv);
38557 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
38558 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
38559 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
38560 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
38561 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
38562 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
38563 return (uint64_t)ret_conv;
38566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38567 if ((this_ptr & 1) != 0) return;
38568 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
38569 CHECK_ACCESS(this_ptr_ptr);
38570 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
38571 FREE((void*)this_ptr);
38572 Score_free(this_ptr_conv);
38575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38576 if ((this_ptr & 1) != 0) return;
38577 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
38578 CHECK_ACCESS(this_ptr_ptr);
38579 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
38580 FREE((void*)this_ptr);
38581 LockableScore_free(this_ptr_conv);
38584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38585 LDKMultiThreadedLockableScore this_obj_conv;
38586 this_obj_conv.inner = (void*)(this_obj & (~1));
38587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38589 MultiThreadedLockableScore_free(this_obj_conv);
38592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
38593 void* score_ptr = (void*)(((uint64_t)score) & ~1);
38594 CHECK_ACCESS(score_ptr);
38595 LDKScore score_conv = *(LDKScore*)(score_ptr);
38596 if (score_conv.free == LDKScore_JCalls_free) {
38597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38598 LDKScore_JCalls_cloned(&score_conv);
38600 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
38601 uint64_t ret_ref = 0;
38602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38605 ret_ref = (uint64_t)ret_var.inner;
38606 if (ret_var.is_owned) {
38612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38613 LDKScorer this_obj_conv;
38614 this_obj_conv.inner = (void*)(this_obj & (~1));
38615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38617 Scorer_free(this_obj_conv);
38620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38621 LDKScoringParameters this_obj_conv;
38622 this_obj_conv.inner = (void*)(this_obj & (~1));
38623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38625 ScoringParameters_free(this_obj_conv);
38628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38629 LDKScoringParameters this_ptr_conv;
38630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38631 this_ptr_conv.is_owned = false;
38632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38633 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
38637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38638 LDKScoringParameters this_ptr_conv;
38639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38640 this_ptr_conv.is_owned = false;
38641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38642 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
38645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38646 LDKScoringParameters this_ptr_conv;
38647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38648 this_ptr_conv.is_owned = false;
38649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38650 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
38654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38655 LDKScoringParameters this_ptr_conv;
38656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38657 this_ptr_conv.is_owned = false;
38658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38659 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
38662 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
38663 LDKScoringParameters this_ptr_conv;
38664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38665 this_ptr_conv.is_owned = false;
38666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38667 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
38671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38672 LDKScoringParameters this_ptr_conv;
38673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38674 this_ptr_conv.is_owned = false;
38675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38676 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
38679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
38680 LDKScoringParameters this_ptr_conv;
38681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38682 this_ptr_conv.is_owned = false;
38683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38684 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
38688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38689 LDKScoringParameters this_ptr_conv;
38690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38691 this_ptr_conv.is_owned = false;
38692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38693 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
38696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
38697 LDKScoringParameters this_ptr_conv;
38698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38699 this_ptr_conv.is_owned = false;
38700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38701 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
38705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38706 LDKScoringParameters this_ptr_conv;
38707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38708 this_ptr_conv.is_owned = false;
38709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38710 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
38713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) {
38714 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg);
38715 uint64_t ret_ref = 0;
38716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38719 ret_ref = (uint64_t)ret_var.inner;
38720 if (ret_var.is_owned) {
38726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38727 LDKScoringParameters obj_conv;
38728 obj_conv.inner = (void*)(obj & (~1));
38729 obj_conv.is_owned = false;
38730 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38731 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
38732 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38733 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38734 CVec_u8Z_free(ret_var);
38738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38739 LDKu8slice ser_ref;
38740 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38741 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38742 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
38743 *ret_conv = ScoringParameters_read(ser_ref);
38744 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38745 return (uint64_t)ret_conv;
38748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
38749 LDKScoringParameters params_conv;
38750 params_conv.inner = (void*)(params & (~1));
38751 params_conv.is_owned = (params & 1) || (params == 0);
38752 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38753 // Warning: we need a move here but no clone is available for LDKScoringParameters
38754 LDKScorer ret_var = Scorer_new(params_conv);
38755 uint64_t ret_ref = 0;
38756 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38757 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38759 ret_ref = (uint64_t)ret_var.inner;
38760 if (ret_var.is_owned) {
38766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
38767 LDKScorer ret_var = Scorer_default();
38768 uint64_t ret_ref = 0;
38769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38772 ret_ref = (uint64_t)ret_var.inner;
38773 if (ret_var.is_owned) {
38779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
38780 LDKScoringParameters ret_var = ScoringParameters_default();
38781 uint64_t ret_ref = 0;
38782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38785 ret_ref = (uint64_t)ret_var.inner;
38786 if (ret_var.is_owned) {
38792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
38793 LDKScorer this_arg_conv;
38794 this_arg_conv.inner = (void*)(this_arg & (~1));
38795 this_arg_conv.is_owned = false;
38796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38797 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
38798 *ret_ret = Scorer_as_Score(&this_arg_conv);
38799 return (uint64_t)ret_ret;
38802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
38803 LDKScorer obj_conv;
38804 obj_conv.inner = (void*)(obj & (~1));
38805 obj_conv.is_owned = false;
38806 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38807 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
38808 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38809 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38810 CVec_u8Z_free(ret_var);
38814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38815 LDKu8slice ser_ref;
38816 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38817 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38818 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
38819 *ret_conv = Scorer_read(ser_ref);
38820 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38821 return (uint64_t)ret_conv;
38824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38825 LDKFilesystemPersister this_obj_conv;
38826 this_obj_conv.inner = (void*)(this_obj & (~1));
38827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38829 FilesystemPersister_free(this_obj_conv);
38832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
38833 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
38834 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
38835 uint64_t ret_ref = 0;
38836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38837 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38839 ret_ref = (uint64_t)ret_var.inner;
38840 if (ret_var.is_owned) {
38846 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
38847 LDKFilesystemPersister this_arg_conv;
38848 this_arg_conv.inner = (void*)(this_arg & (~1));
38849 this_arg_conv.is_owned = false;
38850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38851 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
38852 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
38858 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
38859 LDKChannelManager manager_conv;
38860 manager_conv.inner = (void*)(manager & (~1));
38861 manager_conv.is_owned = false;
38862 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
38863 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
38864 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
38865 return (uint64_t)ret_conv;
38868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
38869 LDKFilesystemPersister this_arg_conv;
38870 this_arg_conv.inner = (void*)(this_arg & (~1));
38871 this_arg_conv.is_owned = false;
38872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38873 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
38874 CHECK_ACCESS(keys_manager_ptr);
38875 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
38876 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
38877 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38878 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
38880 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
38881 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
38882 return (uint64_t)ret_conv;
38885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
38886 LDKFilesystemPersister this_arg_conv;
38887 this_arg_conv.inner = (void*)(this_arg & (~1));
38888 this_arg_conv.is_owned = false;
38889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38890 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
38891 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
38892 return (uint64_t)ret_ret;
38895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38896 LDKBackgroundProcessor this_obj_conv;
38897 this_obj_conv.inner = (void*)(this_obj & (~1));
38898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38900 BackgroundProcessor_free(this_obj_conv);
38903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38904 if ((this_ptr & 1) != 0) return;
38905 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
38906 CHECK_ACCESS(this_ptr_ptr);
38907 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
38908 FREE((void*)this_ptr);
38909 ChannelManagerPersister_free(this_ptr_conv);
38912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
38913 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
38914 CHECK_ACCESS(persister_ptr);
38915 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
38916 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
38917 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38918 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
38920 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
38921 CHECK_ACCESS(event_handler_ptr);
38922 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
38923 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
38924 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38925 LDKEventHandler_JCalls_cloned(&event_handler_conv);
38927 LDKChainMonitor chain_monitor_conv;
38928 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
38929 chain_monitor_conv.is_owned = false;
38930 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
38931 LDKChannelManager channel_manager_conv;
38932 channel_manager_conv.inner = (void*)(channel_manager & (~1));
38933 channel_manager_conv.is_owned = false;
38934 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
38935 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
38936 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
38937 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
38938 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
38939 LDKPeerManager peer_manager_conv;
38940 peer_manager_conv.inner = (void*)(peer_manager & (~1));
38941 peer_manager_conv.is_owned = false;
38942 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
38943 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
38944 CHECK_ACCESS(logger_ptr);
38945 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38946 if (logger_conv.free == LDKLogger_JCalls_free) {
38947 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38948 LDKLogger_JCalls_cloned(&logger_conv);
38950 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
38951 uint64_t ret_ref = 0;
38952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38955 ret_ref = (uint64_t)ret_var.inner;
38956 if (ret_var.is_owned) {
38962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
38963 LDKBackgroundProcessor this_arg_conv;
38964 this_arg_conv.inner = (void*)(this_arg & (~1));
38965 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
38966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38967 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
38968 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
38969 *ret_conv = BackgroundProcessor_join(this_arg_conv);
38970 return (uint64_t)ret_conv;
38973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
38974 LDKBackgroundProcessor this_arg_conv;
38975 this_arg_conv.inner = (void*)(this_arg & (~1));
38976 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
38977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38978 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
38979 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
38980 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
38981 return (uint64_t)ret_conv;
38984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
38988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38989 LDKInvoice this_obj_conv;
38990 this_obj_conv.inner = (void*)(this_obj & (~1));
38991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38993 Invoice_free(this_obj_conv);
38996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38998 a_conv.inner = (void*)(a & (~1));
38999 a_conv.is_owned = false;
39000 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39002 b_conv.inner = (void*)(b & (~1));
39003 b_conv.is_owned = false;
39004 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39005 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
39009 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
39010 LDKInvoice ret_var = Invoice_clone(arg);
39011 uint64_t ret_ref = 0;
39012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39015 ret_ref = (uint64_t)ret_var.inner;
39016 if (ret_var.is_owned) {
39021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39022 LDKInvoice arg_conv;
39023 arg_conv.inner = (void*)(arg & (~1));
39024 arg_conv.is_owned = false;
39025 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39026 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
39030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39031 LDKInvoice orig_conv;
39032 orig_conv.inner = (void*)(orig & (~1));
39033 orig_conv.is_owned = false;
39034 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39035 LDKInvoice ret_var = Invoice_clone(&orig_conv);
39036 uint64_t ret_ref = 0;
39037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39040 ret_ref = (uint64_t)ret_var.inner;
39041 if (ret_var.is_owned) {
39047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39048 LDKSignedRawInvoice this_obj_conv;
39049 this_obj_conv.inner = (void*)(this_obj & (~1));
39050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39052 SignedRawInvoice_free(this_obj_conv);
39055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39056 LDKSignedRawInvoice a_conv;
39057 a_conv.inner = (void*)(a & (~1));
39058 a_conv.is_owned = false;
39059 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39060 LDKSignedRawInvoice b_conv;
39061 b_conv.inner = (void*)(b & (~1));
39062 b_conv.is_owned = false;
39063 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39064 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
39068 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
39069 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
39070 uint64_t ret_ref = 0;
39071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39074 ret_ref = (uint64_t)ret_var.inner;
39075 if (ret_var.is_owned) {
39080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39081 LDKSignedRawInvoice arg_conv;
39082 arg_conv.inner = (void*)(arg & (~1));
39083 arg_conv.is_owned = false;
39084 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39085 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
39089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39090 LDKSignedRawInvoice orig_conv;
39091 orig_conv.inner = (void*)(orig & (~1));
39092 orig_conv.is_owned = false;
39093 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39094 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
39095 uint64_t ret_ref = 0;
39096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39099 ret_ref = (uint64_t)ret_var.inner;
39100 if (ret_var.is_owned) {
39106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39107 LDKRawInvoice this_obj_conv;
39108 this_obj_conv.inner = (void*)(this_obj & (~1));
39109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39111 RawInvoice_free(this_obj_conv);
39114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39115 LDKRawInvoice this_ptr_conv;
39116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39117 this_ptr_conv.is_owned = false;
39118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39119 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
39120 uint64_t ret_ref = 0;
39121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39124 ret_ref = (uint64_t)ret_var.inner;
39125 if (ret_var.is_owned) {
39131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39132 LDKRawInvoice this_ptr_conv;
39133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39134 this_ptr_conv.is_owned = false;
39135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39136 LDKRawDataPart val_conv;
39137 val_conv.inner = (void*)(val & (~1));
39138 val_conv.is_owned = (val & 1) || (val == 0);
39139 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39140 val_conv = RawDataPart_clone(&val_conv);
39141 RawInvoice_set_data(&this_ptr_conv, val_conv);
39144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39145 LDKRawInvoice a_conv;
39146 a_conv.inner = (void*)(a & (~1));
39147 a_conv.is_owned = false;
39148 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39149 LDKRawInvoice b_conv;
39150 b_conv.inner = (void*)(b & (~1));
39151 b_conv.is_owned = false;
39152 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39153 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
39157 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
39158 LDKRawInvoice ret_var = RawInvoice_clone(arg);
39159 uint64_t ret_ref = 0;
39160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39163 ret_ref = (uint64_t)ret_var.inner;
39164 if (ret_var.is_owned) {
39169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39170 LDKRawInvoice arg_conv;
39171 arg_conv.inner = (void*)(arg & (~1));
39172 arg_conv.is_owned = false;
39173 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39174 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
39178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39179 LDKRawInvoice orig_conv;
39180 orig_conv.inner = (void*)(orig & (~1));
39181 orig_conv.is_owned = false;
39182 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39183 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
39184 uint64_t ret_ref = 0;
39185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39188 ret_ref = (uint64_t)ret_var.inner;
39189 if (ret_var.is_owned) {
39195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39196 LDKRawDataPart this_obj_conv;
39197 this_obj_conv.inner = (void*)(this_obj & (~1));
39198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39200 RawDataPart_free(this_obj_conv);
39203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
39204 LDKRawDataPart this_ptr_conv;
39205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39206 this_ptr_conv.is_owned = false;
39207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39208 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
39209 uint64_t ret_ref = 0;
39210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39213 ret_ref = (uint64_t)ret_var.inner;
39214 if (ret_var.is_owned) {
39220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39221 LDKRawDataPart this_ptr_conv;
39222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39223 this_ptr_conv.is_owned = false;
39224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39225 LDKPositiveTimestamp val_conv;
39226 val_conv.inner = (void*)(val & (~1));
39227 val_conv.is_owned = (val & 1) || (val == 0);
39228 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39229 val_conv = PositiveTimestamp_clone(&val_conv);
39230 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
39233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39234 LDKRawDataPart a_conv;
39235 a_conv.inner = (void*)(a & (~1));
39236 a_conv.is_owned = false;
39237 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39238 LDKRawDataPart b_conv;
39239 b_conv.inner = (void*)(b & (~1));
39240 b_conv.is_owned = false;
39241 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39242 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
39246 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
39247 LDKRawDataPart ret_var = RawDataPart_clone(arg);
39248 uint64_t ret_ref = 0;
39249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39252 ret_ref = (uint64_t)ret_var.inner;
39253 if (ret_var.is_owned) {
39258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39259 LDKRawDataPart arg_conv;
39260 arg_conv.inner = (void*)(arg & (~1));
39261 arg_conv.is_owned = false;
39262 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39263 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
39267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39268 LDKRawDataPart orig_conv;
39269 orig_conv.inner = (void*)(orig & (~1));
39270 orig_conv.is_owned = false;
39271 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39272 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
39273 uint64_t ret_ref = 0;
39274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39277 ret_ref = (uint64_t)ret_var.inner;
39278 if (ret_var.is_owned) {
39284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39285 LDKPositiveTimestamp this_obj_conv;
39286 this_obj_conv.inner = (void*)(this_obj & (~1));
39287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39289 PositiveTimestamp_free(this_obj_conv);
39292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39293 LDKPositiveTimestamp a_conv;
39294 a_conv.inner = (void*)(a & (~1));
39295 a_conv.is_owned = false;
39296 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39297 LDKPositiveTimestamp b_conv;
39298 b_conv.inner = (void*)(b & (~1));
39299 b_conv.is_owned = false;
39300 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39301 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
39305 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
39306 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
39307 uint64_t ret_ref = 0;
39308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39311 ret_ref = (uint64_t)ret_var.inner;
39312 if (ret_var.is_owned) {
39317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39318 LDKPositiveTimestamp arg_conv;
39319 arg_conv.inner = (void*)(arg & (~1));
39320 arg_conv.is_owned = false;
39321 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39322 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
39326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39327 LDKPositiveTimestamp orig_conv;
39328 orig_conv.inner = (void*)(orig & (~1));
39329 orig_conv.is_owned = false;
39330 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39331 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
39332 uint64_t ret_ref = 0;
39333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39336 ret_ref = (uint64_t)ret_var.inner;
39337 if (ret_var.is_owned) {
39343 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39344 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
39345 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
39349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
39350 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
39354 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
39355 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
39359 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
39360 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
39364 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
39365 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
39369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39370 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
39371 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
39372 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
39376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
39377 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
39378 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
39382 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39383 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
39384 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
39388 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
39389 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
39393 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
39394 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
39398 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
39399 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
39403 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
39404 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
39408 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
39409 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
39413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
39414 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
39415 int64_t ret_val = Currency_hash(o_conv);
39419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39420 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
39421 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
39422 jboolean ret_val = Currency_eq(a_conv, b_conv);
39426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39427 LDKSha256 this_obj_conv;
39428 this_obj_conv.inner = (void*)(this_obj & (~1));
39429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39431 Sha256_free(this_obj_conv);
39434 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
39435 LDKSha256 ret_var = Sha256_clone(arg);
39436 uint64_t ret_ref = 0;
39437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39440 ret_ref = (uint64_t)ret_var.inner;
39441 if (ret_var.is_owned) {
39446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39447 LDKSha256 arg_conv;
39448 arg_conv.inner = (void*)(arg & (~1));
39449 arg_conv.is_owned = false;
39450 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39451 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
39455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39456 LDKSha256 orig_conv;
39457 orig_conv.inner = (void*)(orig & (~1));
39458 orig_conv.is_owned = false;
39459 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39460 LDKSha256 ret_var = Sha256_clone(&orig_conv);
39461 uint64_t ret_ref = 0;
39462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39465 ret_ref = (uint64_t)ret_var.inner;
39466 if (ret_var.is_owned) {
39472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
39474 o_conv.inner = (void*)(o & (~1));
39475 o_conv.is_owned = false;
39476 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39477 int64_t ret_val = Sha256_hash(&o_conv);
39481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39483 a_conv.inner = (void*)(a & (~1));
39484 a_conv.is_owned = false;
39485 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39487 b_conv.inner = (void*)(b & (~1));
39488 b_conv.is_owned = false;
39489 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39490 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
39494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39495 LDKDescription this_obj_conv;
39496 this_obj_conv.inner = (void*)(this_obj & (~1));
39497 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39499 Description_free(this_obj_conv);
39502 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
39503 LDKDescription ret_var = Description_clone(arg);
39504 uint64_t ret_ref = 0;
39505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39508 ret_ref = (uint64_t)ret_var.inner;
39509 if (ret_var.is_owned) {
39514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39515 LDKDescription arg_conv;
39516 arg_conv.inner = (void*)(arg & (~1));
39517 arg_conv.is_owned = false;
39518 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39519 int64_t ret_val = Description_clone_ptr(&arg_conv);
39523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39524 LDKDescription orig_conv;
39525 orig_conv.inner = (void*)(orig & (~1));
39526 orig_conv.is_owned = false;
39527 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39528 LDKDescription ret_var = Description_clone(&orig_conv);
39529 uint64_t ret_ref = 0;
39530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39533 ret_ref = (uint64_t)ret_var.inner;
39534 if (ret_var.is_owned) {
39540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
39541 LDKDescription o_conv;
39542 o_conv.inner = (void*)(o & (~1));
39543 o_conv.is_owned = false;
39544 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39545 int64_t ret_val = Description_hash(&o_conv);
39549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39550 LDKDescription a_conv;
39551 a_conv.inner = (void*)(a & (~1));
39552 a_conv.is_owned = false;
39553 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39554 LDKDescription b_conv;
39555 b_conv.inner = (void*)(b & (~1));
39556 b_conv.is_owned = false;
39557 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39558 jboolean ret_val = Description_eq(&a_conv, &b_conv);
39562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39563 LDKPayeePubKey this_obj_conv;
39564 this_obj_conv.inner = (void*)(this_obj & (~1));
39565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39567 PayeePubKey_free(this_obj_conv);
39570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
39571 LDKPayeePubKey this_ptr_conv;
39572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39573 this_ptr_conv.is_owned = false;
39574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39575 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
39580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39581 LDKPayeePubKey this_ptr_conv;
39582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39583 this_ptr_conv.is_owned = false;
39584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39585 LDKPublicKey val_ref;
39586 CHECK((*env)->GetArrayLength(env, val) == 33);
39587 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39588 PayeePubKey_set_a(&this_ptr_conv, val_ref);
39591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
39592 LDKPublicKey a_arg_ref;
39593 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
39594 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
39595 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
39596 uint64_t ret_ref = 0;
39597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39600 ret_ref = (uint64_t)ret_var.inner;
39601 if (ret_var.is_owned) {
39607 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
39608 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
39609 uint64_t ret_ref = 0;
39610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39613 ret_ref = (uint64_t)ret_var.inner;
39614 if (ret_var.is_owned) {
39619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39620 LDKPayeePubKey arg_conv;
39621 arg_conv.inner = (void*)(arg & (~1));
39622 arg_conv.is_owned = false;
39623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39624 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
39628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39629 LDKPayeePubKey orig_conv;
39630 orig_conv.inner = (void*)(orig & (~1));
39631 orig_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39633 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
39634 uint64_t ret_ref = 0;
39635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39638 ret_ref = (uint64_t)ret_var.inner;
39639 if (ret_var.is_owned) {
39645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
39646 LDKPayeePubKey o_conv;
39647 o_conv.inner = (void*)(o & (~1));
39648 o_conv.is_owned = false;
39649 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39650 int64_t ret_val = PayeePubKey_hash(&o_conv);
39654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39655 LDKPayeePubKey a_conv;
39656 a_conv.inner = (void*)(a & (~1));
39657 a_conv.is_owned = false;
39658 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39659 LDKPayeePubKey b_conv;
39660 b_conv.inner = (void*)(b & (~1));
39661 b_conv.is_owned = false;
39662 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39663 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
39667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39668 LDKExpiryTime this_obj_conv;
39669 this_obj_conv.inner = (void*)(this_obj & (~1));
39670 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39672 ExpiryTime_free(this_obj_conv);
39675 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
39676 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
39677 uint64_t ret_ref = 0;
39678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39681 ret_ref = (uint64_t)ret_var.inner;
39682 if (ret_var.is_owned) {
39687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39688 LDKExpiryTime arg_conv;
39689 arg_conv.inner = (void*)(arg & (~1));
39690 arg_conv.is_owned = false;
39691 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39692 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
39696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39697 LDKExpiryTime orig_conv;
39698 orig_conv.inner = (void*)(orig & (~1));
39699 orig_conv.is_owned = false;
39700 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39701 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
39702 uint64_t ret_ref = 0;
39703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39706 ret_ref = (uint64_t)ret_var.inner;
39707 if (ret_var.is_owned) {
39713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
39714 LDKExpiryTime o_conv;
39715 o_conv.inner = (void*)(o & (~1));
39716 o_conv.is_owned = false;
39717 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39718 int64_t ret_val = ExpiryTime_hash(&o_conv);
39722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39723 LDKExpiryTime a_conv;
39724 a_conv.inner = (void*)(a & (~1));
39725 a_conv.is_owned = false;
39726 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39727 LDKExpiryTime b_conv;
39728 b_conv.inner = (void*)(b & (~1));
39729 b_conv.is_owned = false;
39730 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39731 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
39735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39736 LDKMinFinalCltvExpiry this_obj_conv;
39737 this_obj_conv.inner = (void*)(this_obj & (~1));
39738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39740 MinFinalCltvExpiry_free(this_obj_conv);
39743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
39744 LDKMinFinalCltvExpiry this_ptr_conv;
39745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39746 this_ptr_conv.is_owned = false;
39747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39748 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
39752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39753 LDKMinFinalCltvExpiry this_ptr_conv;
39754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39755 this_ptr_conv.is_owned = false;
39756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39757 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
39760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
39761 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
39762 uint64_t ret_ref = 0;
39763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39766 ret_ref = (uint64_t)ret_var.inner;
39767 if (ret_var.is_owned) {
39773 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
39774 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
39775 uint64_t ret_ref = 0;
39776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39779 ret_ref = (uint64_t)ret_var.inner;
39780 if (ret_var.is_owned) {
39785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39786 LDKMinFinalCltvExpiry arg_conv;
39787 arg_conv.inner = (void*)(arg & (~1));
39788 arg_conv.is_owned = false;
39789 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39790 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
39794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39795 LDKMinFinalCltvExpiry orig_conv;
39796 orig_conv.inner = (void*)(orig & (~1));
39797 orig_conv.is_owned = false;
39798 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39799 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
39800 uint64_t ret_ref = 0;
39801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39804 ret_ref = (uint64_t)ret_var.inner;
39805 if (ret_var.is_owned) {
39811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
39812 LDKMinFinalCltvExpiry o_conv;
39813 o_conv.inner = (void*)(o & (~1));
39814 o_conv.is_owned = false;
39815 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39816 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
39820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39821 LDKMinFinalCltvExpiry a_conv;
39822 a_conv.inner = (void*)(a & (~1));
39823 a_conv.is_owned = false;
39824 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39825 LDKMinFinalCltvExpiry b_conv;
39826 b_conv.inner = (void*)(b & (~1));
39827 b_conv.is_owned = false;
39828 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39829 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
39833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39834 if ((this_ptr & 1) != 0) return;
39835 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
39836 CHECK_ACCESS(this_ptr_ptr);
39837 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
39838 FREE((void*)this_ptr);
39839 Fallback_free(this_ptr_conv);
39842 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
39843 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39844 *ret_copy = Fallback_clone(arg);
39845 uint64_t ret_ref = (uint64_t)ret_copy;
39848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39849 LDKFallback* arg_conv = (LDKFallback*)arg;
39850 int64_t ret_val = Fallback_clone_ptr(arg_conv);
39854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39855 LDKFallback* orig_conv = (LDKFallback*)orig;
39856 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39857 *ret_copy = Fallback_clone(orig_conv);
39858 uint64_t ret_ref = (uint64_t)ret_copy;
39862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
39864 LDKCVec_u8Z program_ref;
39865 program_ref.datalen = (*env)->GetArrayLength(env, program);
39866 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
39867 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
39868 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39869 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
39870 uint64_t ret_ref = (uint64_t)ret_copy;
39874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
39875 LDKTwentyBytes a_ref;
39876 CHECK((*env)->GetArrayLength(env, a) == 20);
39877 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
39878 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39879 *ret_copy = Fallback_pub_key_hash(a_ref);
39880 uint64_t ret_ref = (uint64_t)ret_copy;
39884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
39885 LDKTwentyBytes a_ref;
39886 CHECK((*env)->GetArrayLength(env, a) == 20);
39887 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
39888 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39889 *ret_copy = Fallback_script_hash(a_ref);
39890 uint64_t ret_ref = (uint64_t)ret_copy;
39894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
39895 LDKFallback* o_conv = (LDKFallback*)o;
39896 int64_t ret_val = Fallback_hash(o_conv);
39900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39901 LDKFallback* a_conv = (LDKFallback*)a;
39902 LDKFallback* b_conv = (LDKFallback*)b;
39903 jboolean ret_val = Fallback_eq(a_conv, b_conv);
39907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39908 LDKInvoiceSignature this_obj_conv;
39909 this_obj_conv.inner = (void*)(this_obj & (~1));
39910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39912 InvoiceSignature_free(this_obj_conv);
39915 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
39916 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
39917 uint64_t ret_ref = 0;
39918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39921 ret_ref = (uint64_t)ret_var.inner;
39922 if (ret_var.is_owned) {
39927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39928 LDKInvoiceSignature arg_conv;
39929 arg_conv.inner = (void*)(arg & (~1));
39930 arg_conv.is_owned = false;
39931 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39932 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
39936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39937 LDKInvoiceSignature orig_conv;
39938 orig_conv.inner = (void*)(orig & (~1));
39939 orig_conv.is_owned = false;
39940 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39941 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
39942 uint64_t ret_ref = 0;
39943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39946 ret_ref = (uint64_t)ret_var.inner;
39947 if (ret_var.is_owned) {
39953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39954 LDKInvoiceSignature a_conv;
39955 a_conv.inner = (void*)(a & (~1));
39956 a_conv.is_owned = false;
39957 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39958 LDKInvoiceSignature b_conv;
39959 b_conv.inner = (void*)(b & (~1));
39960 b_conv.is_owned = false;
39961 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39962 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
39966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39967 LDKPrivateRoute this_obj_conv;
39968 this_obj_conv.inner = (void*)(this_obj & (~1));
39969 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39971 PrivateRoute_free(this_obj_conv);
39974 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
39975 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
39976 uint64_t ret_ref = 0;
39977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39980 ret_ref = (uint64_t)ret_var.inner;
39981 if (ret_var.is_owned) {
39986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39987 LDKPrivateRoute arg_conv;
39988 arg_conv.inner = (void*)(arg & (~1));
39989 arg_conv.is_owned = false;
39990 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39991 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
39995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39996 LDKPrivateRoute orig_conv;
39997 orig_conv.inner = (void*)(orig & (~1));
39998 orig_conv.is_owned = false;
39999 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40000 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
40001 uint64_t ret_ref = 0;
40002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40005 ret_ref = (uint64_t)ret_var.inner;
40006 if (ret_var.is_owned) {
40012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
40013 LDKPrivateRoute o_conv;
40014 o_conv.inner = (void*)(o & (~1));
40015 o_conv.is_owned = false;
40016 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40017 int64_t ret_val = PrivateRoute_hash(&o_conv);
40021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40022 LDKPrivateRoute a_conv;
40023 a_conv.inner = (void*)(a & (~1));
40024 a_conv.is_owned = false;
40025 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40026 LDKPrivateRoute b_conv;
40027 b_conv.inner = (void*)(b & (~1));
40028 b_conv.is_owned = false;
40029 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40030 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
40034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
40035 LDKSignedRawInvoice this_arg_conv;
40036 this_arg_conv.inner = (void*)(this_arg & (~1));
40037 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40039 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
40040 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
40041 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
40042 return ((uint64_t)ret_conv);
40045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
40046 LDKSignedRawInvoice this_arg_conv;
40047 this_arg_conv.inner = (void*)(this_arg & (~1));
40048 this_arg_conv.is_owned = false;
40049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40050 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
40051 uint64_t ret_ref = 0;
40052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40055 ret_ref = (uint64_t)ret_var.inner;
40056 if (ret_var.is_owned) {
40062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
40063 LDKSignedRawInvoice this_arg_conv;
40064 this_arg_conv.inner = (void*)(this_arg & (~1));
40065 this_arg_conv.is_owned = false;
40066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40067 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
40072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
40073 LDKSignedRawInvoice this_arg_conv;
40074 this_arg_conv.inner = (void*)(this_arg & (~1));
40075 this_arg_conv.is_owned = false;
40076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40077 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
40078 uint64_t ret_ref = 0;
40079 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40080 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40082 ret_ref = (uint64_t)ret_var.inner;
40083 if (ret_var.is_owned) {
40089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40090 LDKSignedRawInvoice this_arg_conv;
40091 this_arg_conv.inner = (void*)(this_arg & (~1));
40092 this_arg_conv.is_owned = false;
40093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40094 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
40095 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
40096 return (uint64_t)ret_conv;
40099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
40100 LDKSignedRawInvoice this_arg_conv;
40101 this_arg_conv.inner = (void*)(this_arg & (~1));
40102 this_arg_conv.is_owned = false;
40103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40104 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
40108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
40109 LDKRawInvoice this_arg_conv;
40110 this_arg_conv.inner = (void*)(this_arg & (~1));
40111 this_arg_conv.is_owned = false;
40112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40113 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40114 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
40118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
40119 LDKRawInvoice this_arg_conv;
40120 this_arg_conv.inner = (void*)(this_arg & (~1));
40121 this_arg_conv.is_owned = false;
40122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40123 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
40124 uint64_t ret_ref = 0;
40125 if ((uint64_t)ret_var.inner > 4096) {
40126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40129 ret_ref = (uint64_t)ret_var.inner;
40130 if (ret_var.is_owned) {
40137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
40138 LDKRawInvoice this_arg_conv;
40139 this_arg_conv.inner = (void*)(this_arg & (~1));
40140 this_arg_conv.is_owned = false;
40141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40142 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
40143 uint64_t ret_ref = 0;
40144 if ((uint64_t)ret_var.inner > 4096) {
40145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40148 ret_ref = (uint64_t)ret_var.inner;
40149 if (ret_var.is_owned) {
40156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40157 LDKRawInvoice this_arg_conv;
40158 this_arg_conv.inner = (void*)(this_arg & (~1));
40159 this_arg_conv.is_owned = false;
40160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40161 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
40162 uint64_t ret_ref = 0;
40163 if ((uint64_t)ret_var.inner > 4096) {
40164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40167 ret_ref = (uint64_t)ret_var.inner;
40168 if (ret_var.is_owned) {
40175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
40176 LDKRawInvoice this_arg_conv;
40177 this_arg_conv.inner = (void*)(this_arg & (~1));
40178 this_arg_conv.is_owned = false;
40179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40180 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
40181 uint64_t ret_ref = 0;
40182 if ((uint64_t)ret_var.inner > 4096) {
40183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40186 ret_ref = (uint64_t)ret_var.inner;
40187 if (ret_var.is_owned) {
40194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
40195 LDKRawInvoice this_arg_conv;
40196 this_arg_conv.inner = (void*)(this_arg & (~1));
40197 this_arg_conv.is_owned = false;
40198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40199 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
40200 uint64_t ret_ref = 0;
40201 if ((uint64_t)ret_var.inner > 4096) {
40202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40205 ret_ref = (uint64_t)ret_var.inner;
40206 if (ret_var.is_owned) {
40213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
40214 LDKRawInvoice this_arg_conv;
40215 this_arg_conv.inner = (void*)(this_arg & (~1));
40216 this_arg_conv.is_owned = false;
40217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40218 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
40219 uint64_t ret_ref = 0;
40220 if ((uint64_t)ret_var.inner > 4096) {
40221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40224 ret_ref = (uint64_t)ret_var.inner;
40225 if (ret_var.is_owned) {
40232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40233 LDKRawInvoice this_arg_conv;
40234 this_arg_conv.inner = (void*)(this_arg & (~1));
40235 this_arg_conv.is_owned = false;
40236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40237 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40238 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
40242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40243 LDKRawInvoice this_arg_conv;
40244 this_arg_conv.inner = (void*)(this_arg & (~1));
40245 this_arg_conv.is_owned = false;
40246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40247 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
40248 uint64_t ret_ref = 0;
40249 if ((uint64_t)ret_var.inner > 4096) {
40250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40253 ret_ref = (uint64_t)ret_var.inner;
40254 if (ret_var.is_owned) {
40261 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
40262 LDKRawInvoice this_arg_conv;
40263 this_arg_conv.inner = (void*)(this_arg & (~1));
40264 this_arg_conv.is_owned = false;
40265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40266 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
40267 int64_tArray ret_arr = NULL;
40268 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40269 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40270 for (size_t o = 0; o < ret_var.datalen; o++) {
40271 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40272 uint64_t ret_conv_14_ref = 0;
40273 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40274 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40276 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
40277 if (ret_conv_14_var.is_owned) {
40278 ret_conv_14_ref |= 1;
40280 ret_arr_ptr[o] = ret_conv_14_ref;
40282 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40283 FREE(ret_var.data);
40287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
40288 LDKRawInvoice this_arg_conv;
40289 this_arg_conv.inner = (void*)(this_arg & (~1));
40290 this_arg_conv.is_owned = false;
40291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40292 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40293 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
40294 uint64_t ret_ref = (uint64_t)ret_copy;
40298 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
40299 LDKRawInvoice this_arg_conv;
40300 this_arg_conv.inner = (void*)(this_arg & (~1));
40301 this_arg_conv.is_owned = false;
40302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40303 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
40307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
40308 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40309 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
40310 return (uint64_t)ret_conv;
40313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
40314 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40315 *ret_conv = PositiveTimestamp_from_system_time(time);
40316 return (uint64_t)ret_conv;
40319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
40320 LDKPositiveTimestamp this_arg_conv;
40321 this_arg_conv.inner = (void*)(this_arg & (~1));
40322 this_arg_conv.is_owned = false;
40323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40324 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
40328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
40329 LDKPositiveTimestamp this_arg_conv;
40330 this_arg_conv.inner = (void*)(this_arg & (~1));
40331 this_arg_conv.is_owned = false;
40332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40333 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
40337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
40338 LDKInvoice this_arg_conv;
40339 this_arg_conv.inner = (void*)(this_arg & (~1));
40340 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40342 this_arg_conv = Invoice_clone(&this_arg_conv);
40343 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
40344 uint64_t ret_ref = 0;
40345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40348 ret_ref = (uint64_t)ret_var.inner;
40349 if (ret_var.is_owned) {
40355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
40356 LDKInvoice this_arg_conv;
40357 this_arg_conv.inner = (void*)(this_arg & (~1));
40358 this_arg_conv.is_owned = false;
40359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40360 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
40361 *ret_conv = Invoice_check_signature(&this_arg_conv);
40362 return (uint64_t)ret_conv;
40365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
40366 LDKSignedRawInvoice signed_invoice_conv;
40367 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
40368 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
40369 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
40370 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
40371 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
40372 *ret_conv = Invoice_from_signed(signed_invoice_conv);
40373 return (uint64_t)ret_conv;
40376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
40377 LDKInvoice this_arg_conv;
40378 this_arg_conv.inner = (void*)(this_arg & (~1));
40379 this_arg_conv.is_owned = false;
40380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40381 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
40385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
40386 LDKInvoice this_arg_conv;
40387 this_arg_conv.inner = (void*)(this_arg & (~1));
40388 this_arg_conv.is_owned = false;
40389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40390 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
40395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40396 LDKInvoice this_arg_conv;
40397 this_arg_conv.inner = (void*)(this_arg & (~1));
40398 this_arg_conv.is_owned = false;
40399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40400 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40401 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
40405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40406 LDKInvoice this_arg_conv;
40407 this_arg_conv.inner = (void*)(this_arg & (~1));
40408 this_arg_conv.is_owned = false;
40409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40410 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40411 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
40415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40416 LDKInvoice this_arg_conv;
40417 this_arg_conv.inner = (void*)(this_arg & (~1));
40418 this_arg_conv.is_owned = false;
40419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40420 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
40421 uint64_t ret_ref = 0;
40422 if ((uint64_t)ret_var.inner > 4096) {
40423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40426 ret_ref = (uint64_t)ret_var.inner;
40427 if (ret_var.is_owned) {
40434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40435 LDKInvoice this_arg_conv;
40436 this_arg_conv.inner = (void*)(this_arg & (~1));
40437 this_arg_conv.is_owned = false;
40438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40439 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
40444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
40445 LDKInvoice this_arg_conv;
40446 this_arg_conv.inner = (void*)(this_arg & (~1));
40447 this_arg_conv.is_owned = false;
40448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40449 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
40453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
40454 LDKInvoice this_arg_conv;
40455 this_arg_conv.inner = (void*)(this_arg & (~1));
40456 this_arg_conv.is_owned = false;
40457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40458 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
40462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
40463 LDKInvoice this_arg_conv;
40464 this_arg_conv.inner = (void*)(this_arg & (~1));
40465 this_arg_conv.is_owned = false;
40466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40467 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
40471 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
40472 LDKInvoice this_arg_conv;
40473 this_arg_conv.inner = (void*)(this_arg & (~1));
40474 this_arg_conv.is_owned = false;
40475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40476 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
40477 int64_tArray ret_arr = NULL;
40478 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40479 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40480 for (size_t o = 0; o < ret_var.datalen; o++) {
40481 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40482 uint64_t ret_conv_14_ref = 0;
40483 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40484 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40486 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
40487 if (ret_conv_14_var.is_owned) {
40488 ret_conv_14_ref |= 1;
40490 ret_arr_ptr[o] = ret_conv_14_ref;
40492 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40493 FREE(ret_var.data);
40497 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
40498 LDKInvoice this_arg_conv;
40499 this_arg_conv.inner = (void*)(this_arg & (~1));
40500 this_arg_conv.is_owned = false;
40501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40502 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
40503 int64_tArray ret_arr = NULL;
40504 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40505 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40506 for (size_t l = 0; l < ret_var.datalen; l++) {
40507 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40508 uint64_t ret_conv_11_ref = 0;
40509 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40510 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40512 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
40513 if (ret_conv_11_var.is_owned) {
40514 ret_conv_11_ref |= 1;
40516 ret_arr_ptr[l] = ret_conv_11_ref;
40518 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40519 FREE(ret_var.data);
40523 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
40524 LDKInvoice this_arg_conv;
40525 this_arg_conv.inner = (void*)(this_arg & (~1));
40526 this_arg_conv.is_owned = false;
40527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40528 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
40532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
40533 LDKInvoice this_arg_conv;
40534 this_arg_conv.inner = (void*)(this_arg & (~1));
40535 this_arg_conv.is_owned = false;
40536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40537 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40538 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
40539 uint64_t ret_ref = (uint64_t)ret_copy;
40543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
40544 LDKStr description_conv = java_to_owned_str(env, description);
40545 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
40546 *ret_conv = Description_new(description_conv);
40547 return (uint64_t)ret_conv;
40550 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
40551 LDKDescription this_arg_conv;
40552 this_arg_conv.inner = (void*)(this_arg & (~1));
40553 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40555 this_arg_conv = Description_clone(&this_arg_conv);
40556 LDKStr ret_str = Description_into_inner(this_arg_conv);
40557 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
40563 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
40564 *ret_conv = ExpiryTime_from_seconds(seconds);
40565 return (uint64_t)ret_conv;
40568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
40569 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
40570 *ret_conv = ExpiryTime_from_duration(duration);
40571 return (uint64_t)ret_conv;
40574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
40575 LDKExpiryTime this_arg_conv;
40576 this_arg_conv.inner = (void*)(this_arg & (~1));
40577 this_arg_conv.is_owned = false;
40578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40579 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
40583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
40584 LDKExpiryTime this_arg_conv;
40585 this_arg_conv.inner = (void*)(this_arg & (~1));
40586 this_arg_conv.is_owned = false;
40587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40588 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
40592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
40593 LDKRouteHint hops_conv;
40594 hops_conv.inner = (void*)(hops & (~1));
40595 hops_conv.is_owned = (hops & 1) || (hops == 0);
40596 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
40597 hops_conv = RouteHint_clone(&hops_conv);
40598 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
40599 *ret_conv = PrivateRoute_new(hops_conv);
40600 return (uint64_t)ret_conv;
40603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
40604 LDKPrivateRoute this_arg_conv;
40605 this_arg_conv.inner = (void*)(this_arg & (~1));
40606 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40608 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
40609 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
40610 uint64_t ret_ref = 0;
40611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40614 ret_ref = (uint64_t)ret_var.inner;
40615 if (ret_var.is_owned) {
40621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40622 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
40623 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
40627 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
40628 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
40632 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
40633 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
40637 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
40638 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
40642 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
40643 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
40647 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
40648 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
40652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40653 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
40654 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
40655 jboolean ret_val = CreationError_eq(a_conv, b_conv);
40659 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
40660 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
40661 LDKStr ret_str = CreationError_to_str(o_conv);
40662 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40667 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40668 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
40669 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
40673 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
40674 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
40678 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
40679 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
40683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
40684 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
40688 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
40689 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
40693 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
40694 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
40698 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
40699 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
40703 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
40704 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
40708 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
40709 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
40713 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
40714 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
40718 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
40719 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
40723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40724 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
40725 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
40726 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
40730 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
40731 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
40732 LDKStr ret_str = SemanticError_to_str(o_conv);
40733 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40739 if ((this_ptr & 1) != 0) return;
40740 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
40741 CHECK_ACCESS(this_ptr_ptr);
40742 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
40743 FREE((void*)this_ptr);
40744 SignOrCreationError_free(this_ptr_conv);
40747 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
40748 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40749 *ret_copy = SignOrCreationError_clone(arg);
40750 uint64_t ret_ref = (uint64_t)ret_copy;
40753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40754 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
40755 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
40759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40760 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
40761 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40762 *ret_copy = SignOrCreationError_clone(orig_conv);
40763 uint64_t ret_ref = (uint64_t)ret_copy;
40767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
40768 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40769 *ret_copy = SignOrCreationError_sign_error();
40770 uint64_t ret_ref = (uint64_t)ret_copy;
40774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
40775 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
40776 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40777 *ret_copy = SignOrCreationError_creation_error(a_conv);
40778 uint64_t ret_ref = (uint64_t)ret_copy;
40782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40783 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
40784 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
40785 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
40789 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
40790 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
40791 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
40792 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40798 LDKInvoicePayer this_obj_conv;
40799 this_obj_conv.inner = (void*)(this_obj & (~1));
40800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40802 InvoicePayer_free(this_obj_conv);
40805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40806 if ((this_ptr & 1) != 0) return;
40807 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
40808 CHECK_ACCESS(this_ptr_ptr);
40809 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
40810 FREE((void*)this_ptr);
40811 Payer_free(this_ptr_conv);
40814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40815 if ((this_ptr & 1) != 0) return;
40816 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
40817 CHECK_ACCESS(this_ptr_ptr);
40818 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
40819 FREE((void*)this_ptr);
40820 Router_free(this_ptr_conv);
40823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40824 LDKRetryAttempts this_obj_conv;
40825 this_obj_conv.inner = (void*)(this_obj & (~1));
40826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40828 RetryAttempts_free(this_obj_conv);
40831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
40832 LDKRetryAttempts this_ptr_conv;
40833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40834 this_ptr_conv.is_owned = false;
40835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40836 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
40840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40841 LDKRetryAttempts this_ptr_conv;
40842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40843 this_ptr_conv.is_owned = false;
40844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40845 RetryAttempts_set_a(&this_ptr_conv, val);
40848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
40849 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
40850 uint64_t ret_ref = 0;
40851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40854 ret_ref = (uint64_t)ret_var.inner;
40855 if (ret_var.is_owned) {
40861 static inline uint64_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
40862 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
40863 uint64_t ret_ref = 0;
40864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40867 ret_ref = (uint64_t)ret_var.inner;
40868 if (ret_var.is_owned) {
40873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40874 LDKRetryAttempts arg_conv;
40875 arg_conv.inner = (void*)(arg & (~1));
40876 arg_conv.is_owned = false;
40877 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40878 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
40882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40883 LDKRetryAttempts orig_conv;
40884 orig_conv.inner = (void*)(orig & (~1));
40885 orig_conv.is_owned = false;
40886 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40887 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
40888 uint64_t ret_ref = 0;
40889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40892 ret_ref = (uint64_t)ret_var.inner;
40893 if (ret_var.is_owned) {
40899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40900 LDKRetryAttempts a_conv;
40901 a_conv.inner = (void*)(a & (~1));
40902 a_conv.is_owned = false;
40903 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40904 LDKRetryAttempts b_conv;
40905 b_conv.inner = (void*)(b & (~1));
40906 b_conv.is_owned = false;
40907 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40908 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
40912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
40913 LDKRetryAttempts o_conv;
40914 o_conv.inner = (void*)(o & (~1));
40915 o_conv.is_owned = false;
40916 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40917 int64_t ret_val = RetryAttempts_hash(&o_conv);
40921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40922 if ((this_ptr & 1) != 0) return;
40923 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
40924 CHECK_ACCESS(this_ptr_ptr);
40925 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
40926 FREE((void*)this_ptr);
40927 PaymentError_free(this_ptr_conv);
40930 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
40931 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40932 *ret_copy = PaymentError_clone(arg);
40933 uint64_t ret_ref = (uint64_t)ret_copy;
40936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40937 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
40938 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
40942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40943 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
40944 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40945 *ret_copy = PaymentError_clone(orig_conv);
40946 uint64_t ret_ref = (uint64_t)ret_copy;
40950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
40951 LDKStr a_conv = java_to_owned_str(env, a);
40952 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40953 *ret_copy = PaymentError_invoice(a_conv);
40954 uint64_t ret_ref = (uint64_t)ret_copy;
40958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
40959 LDKLightningError a_conv;
40960 a_conv.inner = (void*)(a & (~1));
40961 a_conv.is_owned = (a & 1) || (a == 0);
40962 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40963 a_conv = LightningError_clone(&a_conv);
40964 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40965 *ret_copy = PaymentError_routing(a_conv);
40966 uint64_t ret_ref = (uint64_t)ret_copy;
40970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
40971 void* a_ptr = (void*)(((uint64_t)a) & ~1);
40972 CHECK_ACCESS(a_ptr);
40973 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
40974 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
40975 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40976 *ret_copy = PaymentError_sending(a_conv);
40977 uint64_t ret_ref = (uint64_t)ret_copy;
40981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry_attempts) {
40982 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
40983 CHECK_ACCESS(payer_ptr);
40984 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
40985 if (payer_conv.free == LDKPayer_JCalls_free) {
40986 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40987 LDKPayer_JCalls_cloned(&payer_conv);
40989 void* router_ptr = (void*)(((uint64_t)router) & ~1);
40990 CHECK_ACCESS(router_ptr);
40991 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40992 if (router_conv.free == LDKRouter_JCalls_free) {
40993 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40994 LDKRouter_JCalls_cloned(&router_conv);
40996 LDKMultiThreadedLockableScore scorer_conv;
40997 scorer_conv.inner = (void*)(scorer & (~1));
40998 scorer_conv.is_owned = false;
40999 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
41000 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
41001 CHECK_ACCESS(logger_ptr);
41002 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41003 if (logger_conv.free == LDKLogger_JCalls_free) {
41004 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41005 LDKLogger_JCalls_cloned(&logger_conv);
41007 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
41008 CHECK_ACCESS(event_handler_ptr);
41009 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
41010 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
41011 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41012 LDKEventHandler_JCalls_cloned(&event_handler_conv);
41014 LDKRetryAttempts retry_attempts_conv;
41015 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
41016 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
41017 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
41018 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
41019 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
41020 uint64_t ret_ref = 0;
41021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41024 ret_ref = (uint64_t)ret_var.inner;
41025 if (ret_var.is_owned) {
41031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
41032 LDKInvoicePayer this_arg_conv;
41033 this_arg_conv.inner = (void*)(this_arg & (~1));
41034 this_arg_conv.is_owned = false;
41035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41036 LDKInvoice invoice_conv;
41037 invoice_conv.inner = (void*)(invoice & (~1));
41038 invoice_conv.is_owned = false;
41039 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
41040 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41041 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
41042 return (uint64_t)ret_conv;
41045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) {
41046 LDKInvoicePayer this_arg_conv;
41047 this_arg_conv.inner = (void*)(this_arg & (~1));
41048 this_arg_conv.is_owned = false;
41049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41050 LDKInvoice invoice_conv;
41051 invoice_conv.inner = (void*)(invoice & (~1));
41052 invoice_conv.is_owned = false;
41053 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
41054 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41055 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
41056 return (uint64_t)ret_conv;
41059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
41060 LDKInvoicePayer this_arg_conv;
41061 this_arg_conv.inner = (void*)(this_arg & (~1));
41062 this_arg_conv.is_owned = false;
41063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41064 LDKPublicKey pubkey_ref;
41065 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41066 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41067 LDKThirtyTwoBytes payment_preimage_ref;
41068 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41069 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41070 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41071 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
41072 return (uint64_t)ret_conv;
41075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
41076 LDKInvoicePayer this_arg_conv;
41077 this_arg_conv.inner = (void*)(this_arg & (~1));
41078 this_arg_conv.is_owned = false;
41079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41080 unsigned char payment_hash_arr[32];
41081 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41082 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
41083 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
41084 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
41087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41088 LDKInvoicePayer this_arg_conv;
41089 this_arg_conv.inner = (void*)(this_arg & (~1));
41090 this_arg_conv.is_owned = false;
41091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41092 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41093 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
41094 return (uint64_t)ret_ret;
41097 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) {
41098 LDKChannelManager channelmanager_conv;
41099 channelmanager_conv.inner = (void*)(channelmanager & (~1));
41100 channelmanager_conv.is_owned = false;
41101 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
41102 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
41103 CHECK_ACCESS(keys_manager_ptr);
41104 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
41105 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
41106 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41107 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
41109 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
41110 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
41111 CHECK_ACCESS(amt_msat_ptr);
41112 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
41113 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
41114 LDKStr description_conv = java_to_owned_str(env, description);
41115 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
41116 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
41117 return (uint64_t)ret_conv;
41120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41121 LDKDefaultRouter this_obj_conv;
41122 this_obj_conv.inner = (void*)(this_obj & (~1));
41123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41125 DefaultRouter_free(this_obj_conv);
41128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
41129 LDKNetworkGraph network_graph_conv;
41130 network_graph_conv.inner = (void*)(network_graph & (~1));
41131 network_graph_conv.is_owned = false;
41132 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41133 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
41134 CHECK_ACCESS(logger_ptr);
41135 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41136 if (logger_conv.free == LDKLogger_JCalls_free) {
41137 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41138 LDKLogger_JCalls_cloned(&logger_conv);
41140 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
41141 uint64_t ret_ref = 0;
41142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41145 ret_ref = (uint64_t)ret_var.inner;
41146 if (ret_var.is_owned) {
41152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
41153 LDKDefaultRouter this_arg_conv;
41154 this_arg_conv.inner = (void*)(this_arg & (~1));
41155 this_arg_conv.is_owned = false;
41156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41157 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
41158 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
41159 return (uint64_t)ret_ret;
41162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
41163 LDKChannelManager this_arg_conv;
41164 this_arg_conv.inner = (void*)(this_arg & (~1));
41165 this_arg_conv.is_owned = false;
41166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41167 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
41168 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
41169 return (uint64_t)ret_ret;
41172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
41173 LDKStr s_conv = java_to_owned_str(env, s);
41174 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
41175 *ret_conv = SiPrefix_from_str(s_conv);
41176 return (uint64_t)ret_conv;
41179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
41180 LDKStr s_conv = java_to_owned_str(env, s);
41181 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
41182 *ret_conv = Invoice_from_str(s_conv);
41183 return (uint64_t)ret_conv;
41186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
41187 LDKStr s_conv = java_to_owned_str(env, s);
41188 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
41189 *ret_conv = SignedRawInvoice_from_str(s_conv);
41190 return (uint64_t)ret_conv;
41193 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
41195 o_conv.inner = (void*)(o & (~1));
41196 o_conv.is_owned = false;
41197 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41198 LDKStr ret_str = Invoice_to_str(&o_conv);
41199 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41204 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
41205 LDKSignedRawInvoice o_conv;
41206 o_conv.inner = (void*)(o & (~1));
41207 o_conv.is_owned = false;
41208 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41209 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
41210 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41215 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
41216 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
41217 LDKStr ret_str = Currency_to_str(o_conv);
41218 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41223 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
41224 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
41225 LDKStr ret_str = SiPrefix_to_str(o_conv);
41226 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);